PHP code example of kryptamine / groot
1. Go to this page and download the library: Download kryptamine/groot 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/ */
kryptamine / groot example snippets
use Kryptamine\Groot\Attributes\Get;
use Kryptamine\Groot\Attributes\Post;
use Kryptamine\Groot\Attributes\Controller;
#[Controller('users')]
class UserController
{
#[Get('/')]
public function getUsers(): void
{
}
#[Get('/{id:\d+}')]
public function getUser(int $id): void
{
}
#[Post('/')]
public function saveUser(): void
{
}
...
}
namespace Kryptamine\Groot;
use Kryptamine\Groot\Router;
use Bramus\Router\Router as BramusRouter;
use Kryptamine\Groot\Adapters\BramusRouterAdapter;
ter->register();
$bramusRouter->run();