1. Go to this page and download the library: Download peroxide/api-skeleton 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/ */
peroxide / api-skeleton example snippets
// config/routes.php file
return (function (App $app) {
// Activate Global CORS
$app = (new GlobalCors($app))->getDecorated();
$app->get('/health-check', HealthCheckController::class);
// Your routes definitions here
// You can config route in your preferred directory
$app = ;
// ...
})->add(new AMiddlewareAction());
/**
* Catch-all route to serve a 404 Not Found page if none of the routes match
* NOTE: make sure this route is defined last
*/
$app->map(['GET', 'POST', 'PUT', 'DELETE', 'PATCH'], '/{routes:.+}', function ($request, $response) {
throw new HttpNotFoundException($request);
});
return $app;
})($app);
final class CreateUsersTableTest extends AbstractMigration
{
public function change(): void
{
$table = $this->table('users');
$table
->addColumn('email', 'string', ['limit' => 130])
->addColumn('created_at', 'datetime', ['default' => 'CURRENT_TIMESTAMP'])
->addColumn('updated_at', 'datetime', ['null' => true])
->create();
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.