yesgooo / phpboot
PHP RESTful API framework.
v3.0.2
2022-09-21 02:55 UTC
Requires
- php: >=5.5.9
- doctrine/cache: ^1.6
- guzzlehttp/guzzle: ^6.2
- monolog/monolog: ~1.0
- moontoast/math: 1.2.1
- mtdowling/jmespath.php: ^2.4
- nikic/fast-route: ^1.2
- php-di/php-di: ^5.4
- phpdocumentor/reflection-docblock: ^3.1,!=3.2.1|^4.3
- ramsey/uuid: 3.9.3
- symfony/console: ~3.4|~4.0
- symfony/http-foundation: ^3.3
- symfony/http-kernel: ^3.3
- vlucas/valitron: ^1.4
Requires (Dev)
- phpunit/phpunit: ~4.0
- satooshi/php-coveralls: ~0.6
- dev-master
- v3.0.2
- v3.0.1
- v2.2.0
- v2.1.1
- v2.1.0
- 2.0.x-dev
- v2.0.8
- v2.0.7
- v2.0.6
- v2.0.6-beta
- v2.0.4-beta
- v2.0.2-beta
- 2.0.1.x-dev
- 1.2.x-dev
- 1.2.4.x-dev
- v1.2.4
- v1.2.3
- 1.2.2.x-dev
- v1.2.2
- 1.2.1.x-dev
- 1.1.x-dev
- 1.0.x-dev
- dev-feature/0707_cache
- dev-hotfix/2021_10_25_add_log
- dev-hotfix/1025_addLog
- dev-feature/patch-4-2
- dev-feature/patch-4-1
- dev-feature/patch-3
- dev-base-master
- dev-feature/patch-2
- dev-origin-master
- dev-patch-1
- dev-command
- dev-workflow
This package is auto-updated.
Last update: 2025-03-09 04:02:33 UTC
README
phprs-restful 2.x is renamed to PhpBoot, and incompatible with 1.x. You can get the old version from phprs-restful v1.x
PhpBoot is an easy and powerful PHP framework for building RESTful/Microservices APIs.
Specialities
PhpBoot provides mainstream features, such as IOC, HOOK, ORM, Validation, etc. But the most striking features are:
1. Designing object-oriented APIs
WITHOUT PhpBoot:
class BookController
{
public function findBooks(Request $request)
{
$name = $request->get('name');
$offset = $request->get('offset', 0);
$limit = $request->get('limit', 10);
...
return new Response(['total'=>$total, 'data'=>$books]);
}
public function createBook(Request $request)
...
}
WITH PhpBoot:
/**
* @path /books/
*/
class Books
{
/**
* @route GET /
* @return Book[]
*/
public function findBooks($name, &$total=null, $offset=0, $limit=10)
{
$total = ...
...
return $books;
}
/**
* @route POST /
* @param Book $book {@bind request.request} bind $book with http body
* @return string id of created book
*/
public function createBook(Book $book)
{
$id = ...
return $id;
}
}
Read more: phpboot-example。
2. Swagger
PhpBoot can automatically generate Swagger JSON,which can be rendered as document by Swagger UI like this:

Read more: Online Demo
3. RPC
Call the remote Books with RPC:
$books = $app->make(RpcProxy::class, [
'interface'=>Books::class,
'prefix'=>'http://x.x.x.x/'
]);
$books->findBooks(...);
Concurrent call RPC:
$res = MultiRpc::run([
function()use($service1){
return $service1->doSomething();
},
function()use($service2){
return $service2->doSomething();
},
]);
Read more: RPC
4. IDE friendly

Features
- Route
- Parameters binding
- Validation
- Dependency Injection(IOC)
- DB
- ORM
- Docgen(Swagger)
- RPC
- Hook
- CLI
Installation
Install composer
curl -s http://getcomposer.org/installer | php
Install PhpBoot
composer require "caoym/phpboot"
index.php
<?php require __DIR__.'/vendor/autoload.php'; $app = \PhpBoot\Application::createByDefault(__DIR__.'/config/config.php'); $app->loadRoutesFromPath(__DIR__.'/App/Controllers'); $app->dispatch();
Help & Documentation
- Documentation
- 中文文档
- Email: caoyangmin@gmail.com