1. Go to this page and download the library: Download raihel/controller 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/ */
raihel / controller example snippets
use App\HelloController;
use Raihel\Controller\Core\ControllerFactory;
use Slim\App;
$app = new App();
use Raihel\Controller\Core\Load\Type\SlimLoadRoute;
ControllerFactory::load(
loadRoute: new SlimLoadRoute($app),
diretory: [__DIR__ . '/../src'],
controllers: [HelloController::class]
);
$app->run();
ControllerFactory::load(
loadRoute: new LumenLoadRoute($router),
diretory: [__DIR__ . '/../app/Http/Controllers'],
);
namespace App;
use Raihel\Controller\Attributes\Controller;
use Raihel\Controller\Attributes\Route\Get;
use Raihel\Controller\Attributes\Route\Put;
#[Controller('home')]
class AppController
{
#[Get]
public function home()
{
echo 'Hello World!';
}
#[Get('hello'), Put('hello')]
public function get2()
{
echo 'Hello World 2!';
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.