digitalbitlabs/simple-pi-framework
Composer 安装命令:
composer require digitalbitlabs/simple-pi-framework
包简介
Simple Pi is REST API framework developed in PHP
README 文档
README
This repository contains the source code of Simple Pi framework. To create a project or app using the framework visit https://github.com/digitalbitlabs/simple-pi
Simple Pi
Simple Pi is a REST API micro framework developed in PHP. The sole purpose of this framework is give you ready to use simple API which allows you to have custom configuration, routes and database operations. To begin with using the framework, follow the steps given below:
Installation
To install Simple Pi, you need to have composer installed. If you don't grab it from https://getcomposer.org/download/
composer require digitalbitlabs/simple-pi my-app
This will create a directory my-app in your current folder with all the code necessary to run the API.
Setup env file
Enter my-app folder and rename the .env.example file to .env
Configure database and application
Customise the configuration parameters in .env file accordingly. You can also update the settings in config.php file placed inside app folder in the root directory of your application.
Setup application routes
Change or add app routes through routes.php file inside app folder in the root directory of your application.
Run the application
To run the app you just created run the following in your terminal from the root folder of your app.
php -S localhost:8000 -t public\
Controllers
Controllers are custom classes to group similar operations together. They can be created inside app\controllers classes. A Demo controller is already present in the repository code.
Database operations
Simple Pi uses Capsule Manager by Laravel for carrying out database operations. For more information visit https://laravel.com/api/8.x/Illuminate/Database/Capsule/Manager.html.
As per the official documentation from Laravel following drivers are supported by Capsule Manager.
- MariaDB 10.2+
- MySQL 5.7+
- PostgreSQL 10.0+
- SQLite 3.8.8+
- SQL Server 2017+
To perform a query to select data simply add the lines at the top of your controller or routes.php file
use SimplePi\Framework\DB;
Then to fetch the records from any table simply use the ORM functions provided by Laravel. Visit https://laravel.com/docs/9.x/database for more information. For example the query SELECT * FROM demo can be run in the following manner in Simple Pi,
DB::table('demo')->get()->toArray();
That's it. You get an array of data in your database table.
To perform additional operations like delete or update or insert, use the respective functions from
CapsuleManagerclass. The functions can be executed in a similar fashion as Laravel eloquent. You can refer to Laravel eloquent documentation for more details.
Credits
This framework is developed by Sanket Raut as a hobby project at Digitalbit Labs to write a bare metal framework that can be kept as simple as possible.
digitalbitlabs/simple-pi-framework 适用场景与选型建议
digitalbitlabs/simple-pi-framework 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 68 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 07 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「micro framework」 「REST API」 「simple framework」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 digitalbitlabs/simple-pi-framework 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 digitalbitlabs/simple-pi-framework 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 digitalbitlabs/simple-pi-framework 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Anax htmlform module.
Micro Active Record library in PHP, support chain calls, events, and relations.
A PSR-7 compatible library for making CRUD API endpoints
Onix Micro Framework
Api bundle
统计信息
- 总下载量: 68
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-07-29
