1. Go to this page and download the library: Download kittenphp/system library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kittenphp / system example snippets
tten\system\config\AppConfig;
use kitten\system\core\Application;
use kitten\system\core\InitRouteInterface;
use kitten\component\router\RouteCollector;
use kitten\Component\pipeline\MiddlewareInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RedirectResponse;
class Home {
public function index($id){
return 'id:'.$id;
}
}
class Auth implements MiddlewareInterface{
public function handle(Request $request, Closure $next)
{
return new RedirectResponse('/admin/login');
}
}
class Admin{
public function index(){
return 'admin page';
}
public function login(){
return 'login page';
}
}
class RoutManager implements InitRouteInterface{
public function init(RouteCollector $route)
{
$route->get('/',function (){
return 'hello world!';
});
$route->get('/page/{id}','Home@index');
$route->group('/admin',function (RouteCollector $router){
$router->get('','Admin@index')->middleware(Auth::class);
$router->get('/login','Admin@login');
});
}
}
$opt=new AppConfig();
//$opt->setDebug(true);
$app=new Application(new RoutManager(),$opt);
$app->run();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.