varimax / varimax
Varimax The Slim PHP Frameworks
Installs: 464
Dependents: 4
Suggesters: 2
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:project
Requires
- php: ^7.3|^8.0
- ext-bcmath: *
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- ext-openssl: *
- ext-xml: *
- illuminate/container: 8.*
- illuminate/contracts: 8.*
- illuminate/database: 8.*
- illuminate/events: 8.*
- illuminate/filesystem: 8.*
- illuminate/http: 8.*
- illuminate/pagination: 8.*
- illuminate/pipeline: 8.*
- illuminate/support: 8.*
- psr/http-message: 1.*
- psr/log: 1.*
- vlucas/phpdotenv: 5.*
Suggests
- guzzlehttp/guzzle: Suggest Http client of 6.*
- nesbot/carbon: Suggest Carbon DateTime Formating
- varimax/view: Suggest varimax template engine
README
Varimax The Slim PHP Frameworks
Home: http://www.varimax.cn
Source: https://github.com/dcto/varimax
Issues: https://github.com/dcto/varimax/issues
License: MIT
IRC: #varimax on freenode
Develop environment
touch the .env file into the root directory
that's content sample like it's
ENV=dev
DEBUG=2
ENV will load config directory config {ENV}.name
about DEBUG option item 1 vs 2
select 1 will be output error message without code error detail
select 2 will be output detail code exception message to the client
Router
the varimax define some default route rule
':*' => ':.+',
':str' => ':[\w-]+',
':int' => ':[1-9]\d+',
':num' => ':[0-9.-]+',
':any' => ':[\w!@$^&+-=|]+',
':hex' => ':[a-f0-9]+',
':hash' => ':[a-z0-9]+',
':uuid' => ':[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
Restful APIs Style
Method | Path | Action |
------------------------------------------------
GET | /test | index |
GET | /test/(:id) | select |
POST | /test/create | create |
PUT/PATCH | /test/update/(:id) | update |
DELETE | /test/delete/(:id) | delete |
Router demo
//公共组
Router::group( ['id' => 'public', 'prefix' => '/', 'namespace' => 'App\Controller'], function () {
Router::any( '/test/(list:*)/(id:\d+)' )->call( 'Test@test' );
Router::get( '/test/(shop:vip|user)' )->call( 'Test@shop' ); //only allow vip or user string
Router::get( '/test/(shop:vip|user)/(id:|\d+)' )->call( 'Test@shop' );
//注册
Router::post( '/signup' )->call( 'User@register' );
//登录
Router::post( '/signin' )->call( 'User@login' );
//登出
Router::get( '/logout' )->call( 'User@logout' );
//Restful CRUD
Router::restful('/user')->call( 'User@restful');
} );
//验证组
Router::group( ['id' => 'permit', 'prefix' => '/', 'namespace' => 'App\Controller', 'call' => 'App\Controller\Access@auth'], function () {
} );
About Deverloper
Name : D.c (陶之11)
Emai: sdoz@live.com