SlimCustom 轻量级RESTFul开发框架

我要开发同款
匿名用户2017年07月03日
31阅读
开发技术PHP
所属分类Web应用开发、Web框架
授权协议GPL

作品详情

轻量级RESTFul开发框架SlimCustom可以帮助你快速编写简单但功能强大的web应用和API。特色:HTTP路由,中间件,PSR-7支持,依赖注入,门面模式,模型自动验证,字段预处理,多进程任务管理...

开始使用注意:{$变量}需要替换成实际的值,拒绝无脑复制安装&卸载$SlimCustomFrameworkPath/bin/cmd $application app:make      安装$SlimCustomFrameworkPath/bin/cmd $application app:remove    卸载web服务器

PHPbuilt-inserver

Runthefollowingcommandinterminaltostartlocalhostwebserver,assuming./public/ispublic-accessibledirectorywithindex.phpfile:

php -S localhost:8080 -t $SlimCustomFrameworkPath/public/

Nginx配置

这是一个例子,在Nginx虚拟主机上针对域名example.com的配置。它监听80端口上的入境(inbound)HTTP连接。它假定一个PHP-FPM服务器在端口9000上运行。你需要将server_name,error_log,access_log,和root这些指令修改成你自己的值。其中root指令是你的应用程序公共文件根目录的路径;你的Slim应用的index.php前端控制器文件应该放在这个目录中。

server {    listen 80;    server_name example.com;    index index.php;    error_log /path/to/example.error.log;    access_log /path/to/example.access.log;    root /path/to/public;    location / {        try_files $uri $uri/ /index.php$is_args$args;    }    location ~ \.php {        try_files $uri =404;        fastcgi_split_path_info ^(.+\.php)(/.+)$;        include fastcgi_params;        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;        fastcgi_param SCRIPT_NAME $fastcgi_script_name;        fastcgi_index index.php;        fastcgi_pass 127.0.0.1:9000;    }}

slim文档首页

https://www.slimphp.net/docs/start/web-servers.html

目录结构

框架

/bin/cmd                                        命令入口文件(linux)/bin/cmd.bat                                    命令入口文件(windows)/bootstrap/autoload.php                         自动载入/bootstrap/dependencies.php                     框架依赖/config/application.php                         暂时不用/config/configs.php                             默认配置文件/config/errors.php                              错误配置/config/validation.php                          自动验证配置/demo/                                          应用demo/docs/Api/                                      基于phpDoc2生成的php接口文档/Libs/Cache/Cache.php                           缓存/Libs/Console/Console.php                       控制台/Libs/Console/Daemon.php                        任务管理(支持进程管理)/Libs/Container/Container.php                   容器/Libs/Contracts/                                约定/Libs/Controller/Api.php                        接口控制器/Libs/Controller/Controller.php                 控制器抽象类/Libs/Curl/Curl.php                             curl/Libs/Filesystem/Filesystem.php                 文件/Libs/Handlers/Error.php                        异常处理/Libs/Handlers/PhpError.php                     php错误处理/Libs/Helpers/Facades.php                       助手门面/Libs/Helpers/Helpers.php                       助手函数/Libs/Http/Response.php                         响应/Libs/Model/Query/PdoQuery.php                  PDO查询类/Libs/Model/Model.php                           数据模型/Libs/Pageinator/Pageinator.php                 分页/Libs/Session/Session.php                       session/Libs/Support/Arr.php                           数组/Libs/Support/Collection.php                    集合/Libs/Support/MessageBag.php                    消息包/Libs/Support/Str.php                           字符串/Libs/Traits/Macroable.php                      /Libs/Traits/Single.php                         单例/Libs/Valication/Validator.php                  验证器/Libs/App.php                                   应用核心类/vendor/                                        vendor/index.php                                      入口文件/README.MD                                      文档

Demo应用

/bootstrap/routes.php                           路由配置/configs/configs.php                            配置文件/Console/Console.php                            应用控制台/Console/Commands/Hello.php                     命令文件 (hello 命令)/Controller/                                    控制器/Controller/Admin                               控制器分组/Controller/Admin/Index.php                     Admin分组下的Index控制器/data/logs/                                     日志生成目录/data/cache/                                    缓存生成目录/data/daemon/                                   任务进程信息生成目录/docs/                                          docs/Middlewares/                                   中间件/Middlewares/Admin/                             中间件分组/Middlewares/Admin/Index.php                    Admin分组下的Index中间件/Models/                                        模型目录/scripts/                                       脚本目录/scripts/Demo.php                               Demo任务文件/tests/                                         测试/public/                                        开放目录/public/views/                                  视图目录/public/index.php                               入口文件/public/.htaccess                               .htaccess文件
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论