1. Go to this page and download the library: Download maaf/core 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/ */
maaf / core example snippets
use MAAF\Core\Application;
$app = new Application(__DIR__);
$app->run();
namespace App\Modules\MyModule;
use DI\ContainerBuilder;
use MAAF\Core\ModuleLoader\ModuleInterface;
use MAAF\Core\Routing\Router;
final class Module implements ModuleInterface
{
public static function registerServices(ContainerBuilder $builder): void
{
// Service regisztráció
}
public static function registerRoutes(Router $router): void
{
$router->get('/my-route', [MyController::class, 'index']);
}
}
namespace App\Modules\MyModule\Controllers;
use MAAF\Core\Http\Request;
use MAAF\Core\Http\Response;
final class MyController
{
public function index(Request $request): Response
{
return Response::json(['message' => 'Hello MAAF!']);
}
}
use MAAF\Core\Testing\TestCase;
class MyModuleTest extends TestCase
{
public function testModuleLoads(): void
{
$this->moduleHelper->loadModule(MyModule::class, 'MyModule');
$this->moduleHelper->assertModuleLoaded('MyModule');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.