1. Go to this page and download the library: Download pcf/addendum-framework 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/ */
pcf / addendum-framework example snippets
declare(strict_types=1);
namespace App;
use PCF\Addendum\Application\Application;
use PCF\Addendum\Attribute\Actions;
use PCF\Addendum\Attribute\Commands;
use PCF\Addendum\Attribute\Name;
use PCF\Addendum\Attribute\Version;
#[Name('My API')]
#[Version('1.0.0')]
#[Actions(__DIR__ . '/Action')]
#[Commands(__DIR__ . '/Command')]
final class App extends Application
{
}
declare(strict_types=1);
namespace App\Action;
use PCF\Addendum\Action\ActionInterface;
use PCF\Addendum\Attribute\Route;
use PCF\Addendum\Attribute\ValidateRequest;
use PCF\Addendum\Http\Request;
use PCF\Addendum\Validation\Rules\Email;
use PCF\Addendum\Validation\Rules\Required;
#[Route(path: '/users', method: 'POST')]
#[ValidateRequest('email', new Required(), new Email())]
#[ValidateRequest('password', new Required())]
final class PostUserAction implements ActionInterface
{
public function __invoke(Request $request): array
{
return ['ok' => true];
}
}