{"id":24725076,"url":"https://github.com/garymengcom/fastphp","last_synced_at":"2025-04-12T22:19:45.962Z","repository":{"id":41176159,"uuid":"42226866","full_name":"garymengcom/fastphp","owner":"garymengcom","description":"最简洁易懂的PHP MVC框架入门教程","archived":false,"fork":false,"pushed_at":"2024-05-28T17:51:37.000Z","size":91,"stargazers_count":316,"open_issues_count":2,"forks_count":123,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-04-04T10:28:01.874Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.awaimai.com/128.html","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/garymengcom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-10T06:31:45.000Z","updated_at":"2024-11-29T09:40:43.000Z","dependencies_parsed_at":"2025-01-27T13:06:16.838Z","dependency_job_id":"900f0285-d1dc-4a03-a6ee-c8b097c57f25","html_url":"https://github.com/garymengcom/fastphp","commit_stats":null,"previous_names":["garymengcom/fastphp","yeszao/fastphp"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garymengcom%2Ffastphp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garymengcom%2Ffastphp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garymengcom%2Ffastphp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garymengcom%2Ffastphp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/garymengcom","download_url":"https://codeload.github.com/garymengcom/fastphp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248638100,"owners_count":21137604,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-27T13:06:22.887Z","updated_at":"2025-04-12T22:19:45.927Z","avatar_url":"https://github.com/garymengcom.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FastPHP\n\n[![Build Status](https://travis-ci.org/yeszao/fastphp.svg?branch=master)](https://travis-ci.org/yeszao/fastphp)\n[![Latest Stable Version](https://poser.pugx.org/yeszao/fastphp/v/stable)](https://packagist.org/packages/yeszao/fastphp)\n[![Total Downloads](https://poser.pugx.org/yeszao/fastphp/downloads)](https://packagist.org/packages/yeszao/fastphp)\n[![Latest Unstable Version](https://poser.pugx.org/yeszao/fastphp/v/unstable)](https://packagist.org/packages/yeszao/fastphp)\n[![License](https://poser.pugx.org/yeszao/fastphp/license)](https://packagist.org/packages/yeszao/fastphp)\n\n## 简述\n\n**fastphp**是一款简单的PHP MVC框架，目的是方便学习《手把手编写自己的PHP MVC框架》教程的同学下载源代码，详细介绍请参考网站：http://www.awaimai.com/128.html 。\n\n要求：\n\n* PHP 5.4.0+\n\n## 目录说明\n\n```\nproject                 根目录\n├─app                   应用目录\n│  ├─controllers        控制器目录\n│  ├─models             模块目录\n│  ├─views              视图目录\n├─config                配置文件目录\n├─fastphp               框架核心目录\n├─static                静态文件目录\n├─index.php             入口文件\n```\n\n## 使用\n\n### 1.安装\n主要介绍通过composer和git两种安装方法，选择其一即可。\n\n**方法1**：Composer安装（推荐）\n```\ncomposer create-project yeszao/fastphp project --no-dev\n```\n其中，`--no-dev`表示不安装-dev依赖包（PHPUnit）。\n\n**方法2**：Github安装：\n```\ngit clone https://github.com/yeszao/fastphp.git project\n```\n\u003e 说明：这两个命令都会创建并将代码安装到`project`目录。\n\n### 2. 创建数据库\n\n在数据库中创建名为 project 的数据库，并插入两条记录，命令：\n\n```\nCREATE DATABASE `project` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;\nUSE `project`;\n\nCREATE TABLE `item` (\n    `id` int(11) NOT NULL auto_increment,\n    `item_name` varchar(255) NOT NULL,\n    PRIMARY KEY (`id`)\n) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;\n \nINSERT INTO `item` VALUES(1, 'Hello World.');\nINSERT INTO `item` VALUES(2, 'Lets go!');\n```\n\n### 3.修改数据库配置文件\n\n打开配置文件 config/config.php ，使之与自己的数据库匹配\n\n```\n$config['db']['host'] = 'localhost';\n$config['db']['username'] = 'root';\n$config['db']['password'] = '123456';\n$config['db']['dbname'] = 'project';\n```\n\n### 4.配置Nginx或Apache\n在Apache或Nginx中创建一个站点，把 project 设置为站点根目录（入口文件 index.php 所在的目录）。\n\n然后设置单一入口， Apache服务器配置：\n```\n\u003cIfModule mod_rewrite.c\u003e\n    # 打开Rerite功能\n    RewriteEngine On\n\n    # 如果请求的是真实存在的文件或目录，直接访问\n    RewriteCond %{REQUEST_FILENAME} !-f\n    RewriteCond %{REQUEST_FILENAME} !-d\n\n    # 如果访问的文件或目录不是真事存在，分发请求至 index.php\n    RewriteRule . index.php\n\u003c/IfModule\u003e\n```\nNginx服务器配置：\n```\nlocation / {\n    # 重新向所有非真实存在的请求到index.php\n    try_files $uri $uri/ /index.php$args;\n}\n```\n\n### 5.测试访问\n\n然后访问站点域名：http://localhost/ 就可以了。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarymengcom%2Ffastphp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgarymengcom%2Ffastphp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarymengcom%2Ffastphp/lists"}