1. Go to this page and download the library: Download tempest/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/ */
tempest / framework example snippets
final class BookController
{
#[Get('/books/{book}')]
public function show(Book $book): Response
{
return new Ok($book);
}
#[Post('/books')]
public function store(CreateBookRequest $request): Response
{
$book = map($request)->to(Book::class)->save();
return new Redirect([self::class, 'show'], book: $book->id);
}
// …
}
final class MigrateUpCommand
{
public function __construct(
private Console $console,
private MigrationManager $migrationManager,
) {}
#[ConsoleCommand(
name: 'migrate:up',
description: 'Run all new migrations',
middleware: [ForceMiddleware::class, CautionMiddleware::class],
)]
public function __invoke(): void
{
$this->migrationManager->up();
$this->console->success("Everything migrated");
}
#[EventHandler]
public function onMigrationMigrated(MigrationMigrated $migrationMigrated): void
{
$this->console->writeln("- {$migrationMigrated->name}");
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.