From ebd42208d1b06dc47989a14b582770c766065223 Mon Sep 17 00:00:00 2001 From: Enzo Innocenzi Date: Fri, 21 Mar 2025 20:13:28 +0100 Subject: [PATCH 1/9] feat: reorganize documentation --- .../main/0-getting-started/00-introduction.md | 80 ++++++ .../0-getting-started/01-getting-started.md | 188 ++++++++++++ .../main/1-framework/01-getting-started.md | 267 ------------------ .../main/1-framework/02-the-container.md | 1 - .../main/1-framework/03-controllers.md | 1 - .../content/main/1-framework/04-views.md | 1 - .../content/main/1-framework/05-models.md | 1 - .../content/main/1-framework/06-console.md | 1 - .../content/main/1-framework/07-events.md | 1 - .../content/main/1-framework/08-commands.md | 1 - .../content/main/1-framework/09-logging.md | 1 - .../content/main/1-framework/10-caching.md | 1 - .../content/main/1-framework/11-mapper.md | 1 - .../content/main/1-framework/12-validation.md | 3 +- .../content/main/1-framework/13-auth.md | 1 - .../main/1-framework/14-static-pages.md | 1 - .../1-framework/15-primitive-utilities.md | 1 - .../1-framework/16-standalone-components.md | 1 - .../content/main/1-framework/17-testing.md | 1 - .../2-console/02-building-console-commands.md | 1 - .../content/main/2-console/03-input-output.md | 1 - .../content/main/2-console/04-components.md | 1 - .../content/main/2-console/05-scheduler.md | 1 - .../content/main/2-console/06-middleware.md | 1 - ...01-getting-started.md => 07-standalone.md} | 3 +- .../01-bootstrap.md | 1 - .../02-discovery.md | 1 - .../03-container.md | 1 - .../04-tempest-views.md | 1 - .../05-package-development.md | 1 - .../01-getting-started.md | 1 - .../02-custom-language.md | 1 - .../03-adding-tokens.md | 1 - .../{3-highlight => 4-highlight}/04-optin.md | 1 - .../00-roadmap.md} | 1 - .../01-contributing.md} | 1 - 36 files changed, 270 insertions(+), 302 deletions(-) create mode 100644 src/Web/Documentation/content/main/0-getting-started/00-introduction.md create mode 100644 src/Web/Documentation/content/main/0-getting-started/01-getting-started.md delete mode 100644 src/Web/Documentation/content/main/1-framework/01-getting-started.md rename src/Web/Documentation/content/main/2-console/{01-getting-started.md => 07-standalone.md} (97%) rename src/Web/Documentation/content/main/{4-internals => 3-internals}/01-bootstrap.md (99%) rename src/Web/Documentation/content/main/{4-internals => 3-internals}/02-discovery.md (99%) rename src/Web/Documentation/content/main/{4-internals => 3-internals}/03-container.md (98%) rename src/Web/Documentation/content/main/{4-internals => 3-internals}/04-tempest-views.md (99%) rename src/Web/Documentation/content/main/{4-internals => 3-internals}/05-package-development.md (99%) rename src/Web/Documentation/content/main/{3-highlight => 4-highlight}/01-getting-started.md (99%) rename src/Web/Documentation/content/main/{3-highlight => 4-highlight}/02-custom-language.md (99%) rename src/Web/Documentation/content/main/{3-highlight => 4-highlight}/03-adding-tokens.md (99%) rename src/Web/Documentation/content/main/{3-highlight => 4-highlight}/04-optin.md (99%) rename src/Web/Documentation/content/main/{0-intro/roadmap.md => 5-extra-topics/00-roadmap.md} (99%) rename src/Web/Documentation/content/main/{4-internals/00-contributing.md => 5-extra-topics/01-contributing.md} (99%) diff --git a/src/Web/Documentation/content/main/0-getting-started/00-introduction.md b/src/Web/Documentation/content/main/0-getting-started/00-introduction.md new file mode 100644 index 00000000..45c9b762 --- /dev/null +++ b/src/Web/Documentation/content/main/0-getting-started/00-introduction.md @@ -0,0 +1,80 @@ +--- +title: Introduction +description: "Tempest is a PHP framework designed to get out of your way. Its core philosophy is to enable developers to write as little framework-specific code as possible, so that they can focus on application code instead." +--- + +Tempest makes writing PHP applications pleasant thanks to its thoughtfully designed sprinkles of quality-of-life features. + +It embraces modern PHP syntax in its implementation of routing, ORM, console commands, messaging, logging, it takes inspiration from the best front-end frameworks for its templating engine syntax, and provides unique capabilities amongst other framework, such as [discovery](../3-internals/02-discovery), to improve developer experience. + +You may also be interested in reading how it has an [unfair advantage](/blog/unfair-advantage) over other frameworks. + +Code says more than words, so here's what a controller look like when using Tempest: + +```php app/BookController.php +use Tempest\Router\Get; +use Tempest\Router\Post; +use Tempest\Router\Response; +use Tempest\Router\Responses\Ok; +use Tempest\Router\Responses\Redirect; +use function Tempest\uri; + +final readonly 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(uri([self::class, 'show'], book: $book->id)); + } + + // … +} +``` + +And here's a Tempest console command: + +```php app/MigrateUpCommand.php +use Tempest\Console\Console; +use Tempest\Console\ConsoleCommand; +use Tempest\Console\Middleware\ForceMiddleware; +use Tempest\Console\Middleware\CautionMiddleware; +use Tempest\EventBus\EventHandler; + +final readonly 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}"); + } +} +``` + +:::warning Ready to give it a try? +Keep on reading and consider [**giving Tempest a star️ on GitHub**](https://github.com/tempestphp/tempest-framework). If you want to be part of the community, you can [**join our Discord server**](https://discord.gg/pPhpTGUMPQ), and if you feel like contributing, you can check out our [contributing guide](/docs/internals/contributing)! +::: diff --git a/src/Web/Documentation/content/main/0-getting-started/01-getting-started.md b/src/Web/Documentation/content/main/0-getting-started/01-getting-started.md new file mode 100644 index 00000000..ce531cb5 --- /dev/null +++ b/src/Web/Documentation/content/main/0-getting-started/01-getting-started.md @@ -0,0 +1,188 @@ +--- +title: Getting started +description: Tempest can be installed as a standalone PHP project, as well as a package within existing projects. The framework modules can also be installed individually, including in projects built on other frameworks. +--- + +## Installation + +Tempest requires PHP [8.4+](https://www.php.net/downloads.php) and [Composer](https://getcomposer.org/) to be installed. Optionally, you may install either [Bun](https://bun.sh) or [Node](https://nodejs.org) if you chose to bundle front-end assets. + +For a better experience, it is recommended to have a complete development environment, such as [ServBay](https://www.servbay.com), [Herd](https://herd.laravel.com/docs), or [Valet](https://laravel.com/docs/valet). However, Tempest can serve applications using PHP's built-in server just fine. + +Once the prerequisites are installed, you can chose your installation method. Tempest can be a standalone application, or be added in an existing project—even one built on top of another framework. + +## Creating a Tempest application + +To get started with a new Tempest project, you may use {`tempest/app`} as the starting point. The `composer create-project` command will scaffold it for you: + +```sh +composer create-project tempest/app my-app --stability alpha +cd my-app +``` + +If you have a dedicated development environment, you may then access your application by opening `https://my-app.test` in your browser. Otherwise, you may use PHP's built-in server: + +```sh +php tempest serve +# PHP 8.3.3 Development Server (http://localhost:8000) started +``` + +### Scaffolding front-end assets + +Optionally, you may install a basic front-end scaffolding that includes [Vite](https://vite.dev/) and [Tailwind CSS](https://tailwindcss.com/). To do so, run the Vite installer and follow through the wizard: + +```sh +php tempest install vite --tailwind +``` + + +The assets created by this wizard, `main.entrypoint.ts` and `main.entrypoint.css`, are automatically discovered by Tempest. You can serve them using the `` component in your templates. + +You may then run the front-end development server, which will serve your assets on-the-fly: + +```bash +npm run dev +``` + +## Tempest as a package + +If you already have a project, you can opt to install {`tempest/framework`} as a standalone package. You could do this in any project; it could already contain code, or it could be an empty project. + +```sh +composer require tempest/framework:1.0-alpha.5 +``` + +Installing Tempest this way will give you access to the Tempest console, `./vendor/bin/tempest`. Optionally, you can choose to install Tempest's entry points in your project. To do so, you may run the framework installer: + +```txt +./vendor/bin/tempest install framework +``` + +This installer will prompt you to install the following files into your project: + +- `public/index.php` — the web application entry point +- `tempest` – the console application entry point +- `.env.example` – a clean example of a `.env` file +- `.env` – the real environment file for your local installation + +You can choose which files you want to install, and you can always rerun the `install` command at a later point in time. + +## Project structure + +Tempest won't impose any file structure on you: one of its core features is that it will scan all project and package code for you, and will automatically discover any files the framework needs to know about. + +For instance, Tempest is able to differentiate between a controller method and a console command by looking at the code, instead of relying on naming conventions or configuration files. + +:::info +This concept is called [discovery](../3-internals/02-discovery), and is one of Tempest's most powerful features. +::: + +### Examples + +The following projects structures work the same way in Tempest, without requiring any specific configuration: + +```txt +app +├── Console +│   └── RssSyncCommand.php +├── Controllers +│   ├── BlogPostController.php +│   └── HomeController.php +└── Views + ├── blog.view.php + └── home.view.php +``` + +```txt +src +├── Blog +│   ├── BlogPostController.php +│   ├── RssSyncCommand.php +│   └── blog.view.php +└── Home + ├── HomeController.php + └── home.view.php +``` + +From Tempest's perspective, it's all the same. + +## About Discovery + +Discovery works by scanning your project code, and looking at each file and method individually to determine what that code does. For production application, Tempest will cache the discovery process, avoiding any performance overhead. + +As an example, Tempest is able to determine which methods are controller methods based on their route attributes: + +```php app/BlogPostController.php +use Tempest\Router\Get; +use Tempest\Router\Response; +use Tempest\View\View; + +final readonly class BlogPostController +{ + #[Get('/blog')] + public function index(): View + { /* … */ } + + #[Get('/blog/{post}')] + public function show(Post $post): Response + { /* … */ } +} +``` + +And likewise, it's able to detect console commands based on their console command attribute: + +```php src/RssSyncCommand.php +use Tempest\Console\HasConsole; +use Tempest\Console\ConsoleCommand; + +final readonly class RssSyncCommand +{ + use HasConsole; + + #[ConsoleCommand('rss:sync')] + public function __invoke(bool $force = false): void + { /* … */ } +} +``` + +### Discovery in production + +While discovery is a really powerful feature, it also comes with some performance considerations. In production environments, you want to make sure that the discovery workflow is cached. This is done by using the `DISCOVERY_CACHE` environment variable: + +```env .env +{:hl-property:DISCOVERY_CACHE:}={:hl-keyword:true:} +``` + +The most important step is to generate that cache. This is done by running the `discovery:generate`, which should be part of your deployment pipeline. Make sure to run it before any other Tempest command. + +```console +~ ./tempest discovery:generate + ℹ Clearing existing discovery cache… + ✓ Discovery cached has been cleared + ℹ Generating new discovery cache… (cache strategy used: all) + ✓ Cached 1119 items +``` + +### Discovery for local development + +By default, the discovery cache is disabled in local development. Depending on your local setup, it is likely that you will not run into noticeable slowdowns. However, for larger projects, you might benefit from enabling a partial discovery cache: + +```env .env +{:hl-property:DISCOVERY_CACHE:}={:hl-keyword:partial:} +``` + +This caching strategy will only cache discovery for vendor files. For this reason, it is recommended to run `discovery:generate` after every composer update: + +```json +{:hl-comment:// …:} + +"scripts": { + "post-package-update": [ + "php tempest discovery:generate" + ] +} +``` + +:::info +Note that, if you've created your project using {`tempest/app`}, you'll have the `post-package-update` script already included. You may read the [internal documentation about discovery](../3-internals/02-discovery) to learn more. +::: diff --git a/src/Web/Documentation/content/main/1-framework/01-getting-started.md b/src/Web/Documentation/content/main/1-framework/01-getting-started.md deleted file mode 100644 index 1bf474ae..00000000 --- a/src/Web/Documentation/content/main/1-framework/01-getting-started.md +++ /dev/null @@ -1,267 +0,0 @@ ---- -title: Getting started -category: framework -description: "Tempest is a PHP framework that gets out of your way. Its design philosophy is that developers should write as little framework-related code as possible, so that they can focus on application code instead." ---- - -## Introduction - -Tempest embraces **modern PHP syntax** and covers a wide range of features: routing, MVC, ORM and database, rich console applications, events and commands, logging, a modern view engine, and unique capabilities such as [discovery](#project-structure) to improve developer experience. - -Tempest can be installed **as a standalone PHP project**, as well as **a package within existing projects**. The framework modules — like, for example, {`tempest/console`} or {`tempest/event-bus`} — can also be installed **individually**, including in projects built on other frameworks. - -Since code says more than words, here's a Tempest controller: - -```php -// app/BookController.php - -use Tempest\Router\Get; -use Tempest\Router\Post; -use Tempest\Router\Response; -use Tempest\Router\Responses\Ok; -use Tempest\Router\Responses\Redirect; -use function Tempest\uri; - -final readonly 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(uri([self::class, 'show'], book: $book->id)); - } - - // … -} -``` - -And here's a Tempest console command: - -```php -// app/MigrateUpCommand.php - -use Tempest\Console\Console; -use Tempest\Console\ConsoleCommand; -use Tempest\Console\Middleware\ForceMiddleware; -use Tempest\Console\Middleware\CautionMiddleware; -use Tempest\EventBus\EventHandler; - -final readonly 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}"); - } -} -``` - -Ready to give it a try? Keep on reading and consider [**giving Tempest a star️ on GitHub**](https://github.com/tempestphp/tempest-framework). If you want to be part of the community, you can [**join our Discord server**](https://discord.gg/pPhpTGUMPQ), and you can check out our [contributing guide](/docs/internals/contributing)! - -## Installation - -You can install Tempest in two ways: as a web app with a basic frontend bootstrap, or by requiring the framework as a package in any project you'd like — these can be projects built on top of other frameworks. - -### A standalone Tempest app - -If you want to start a new Tempest project, you can use {`tempest/app`} as the starting point. Use `composer create-project` to start: - -```bash -composer create-project tempest/app my-app --stability alpha -cd my-app -./tempest install vite --tailwind -``` - -Run NPM: - -```bash -npm run dev -``` - -You can access your app by using PHP's built-in server. - -```text -./tempest serve -PHP 8.3.3 Development Server (http://localhost:8000) started -``` - -### Tempest as a package - -If you don't need an app scaffold, you can opt to install `tempest/framework` as a standalone package. You could do this in any project; it could already contain code, or it could be an empty project. - -```txt -composer require tempest/framework:1.0-alpha.5 -``` - -Installing Tempest this way will give you access to the tempest console as a composer binary: - -```txt -./vendor/bin/tempest -``` - -Optionally, you can choose to install Tempest's entry points in your project: - -```txt -./vendor/bin/tempest install framework -``` - -Installing Tempest into a project means copying one or more of these files into that project: - -- `public/index.php` — the web application entry point -- `tempest` – the console application entry point -- `.env.example` – a clean example of a `.env` file -- `.env` – the real environment file for your local installation - -You can choose which files you want to install, and you can always rerun the `install` command at a later point in time. - -## Project structure - -Tempest won't impose any file structure on you: one of its core features is that it will scan all project and package code for you, and it will automatically discover any files the framework needs to know about. For example: Tempest is able to differentiate between a controller method and a console command by looking at the code, instead of relying on naming conventions or verbose configuration files. This concept is called **discovery**, and it's one of Tempest's most powerful features. - -For example, you can make a project that looks like this: - -```txt -app -├── Console -│   └── RssSyncCommand.php -├── Controllers -│   ├── BlogPostController.php -│   └── HomeController.php -└── Views - ├── blog.view.php - └── home.view.php -``` - -Or a project that looks like this: - -```txt -app -├── Blog -│   ├── BlogPostController.php -│   ├── RssSyncCommand.php -│   └── blog.view.php -└── Home - ├── HomeController.php - └── home.view.php -``` - -From Tempest's perspective, it's all the same. - -Discovery works by scanning your project code, and looking at each file and method individually to determine what that code does. For production apps, Tempest will cache the discovery process, so there's no performance overhead that comes with it. - -As an example, Tempest is able to determine which methods are controller methods based on their route attributes: - -```php -// app/BlogPostController.php - -use Tempest\Router\Get; -use Tempest\Router\Response; -use Tempest\View\View; - -final readonly class BlogPostController -{ - #[Get('/blog')] - public function index(): View - { /* … */ } - - #[Get('/blog/{post}')] - public function show(Post $post): Response - { /* … */ } -} -``` - -And likewise, it's able to detect console commands based on their console command attribute: - -```php -// src/RssSyncCommand.php - -use Tempest\Console\HasConsole; -use Tempest\Console\ConsoleCommand; - -final readonly class RssSyncCommand -{ - use HasConsole; - - #[ConsoleCommand('rss:sync')] - public function __invoke(bool $force = false): void - { /* … */ } -} -``` - -## Discovery in production - -While discovery is a really powerful feature, it also comes with some performance considerations. In production environments, you want to make sure that the discovery workflow is cached. That's done like this: - -```env -{:hl-comment:# .env:} -{:hl-property:DISCOVERY_CACHE:}={:hl-keyword:true:} -``` - -What's important though, is that the production discovery cache will also need to be pre-generated. You can do this by running the `discovery:generate` command: - -```console -~ ./tempest discovery:generate -Clearing existing discovery cache… -Discovery cached has been cleared -Generating new discovery cache… (cache strategy used: all) -Done 1114 items cached -``` - -In other words: it's best that you include the `discovery:generate` command in your deployment pipeline. Make sure to run it before you run any other Tempest commands. - -## Discovery for local development - -By default, the discovery cache will be disabled in local development. Depending on your local setup, it's likely that you won't run into noticeable slowdowns. However, for larger projects, you might benefit from enabling a _partial discovery cache_: - -```env -{:hl-comment:# .env:} -{:hl-property:DISCOVERY_CACHE:}={:hl-keyword:partial:} -``` - -This caching strategy will only cache discovery for vendor files. Keep in mind that you will also have to generate the discovery cache: - -```console -~ ./tempest discovery:generate -Clearing existing discovery cache… -Discovery cached has been cleared -Generating new discovery cache… (cache strategy used: partial) -Done 111 items cached -``` - -If you're using a partial discovery cache, it is recommended to automatically run `discovery:generate` after every composer update: - -```json -{:hl-comment:// …:} - -"scripts": { - "post-package-update": [ - "php tempest discovery:generate" - ] -} -``` - -Note that, if you've created your project using {`tempest/app`}, you'll have the `post-package-update` script already included. If you want to, you can read the [internal documentation about discovery](/docs/internals/02-discovery) to learn more. diff --git a/src/Web/Documentation/content/main/1-framework/02-the-container.md b/src/Web/Documentation/content/main/1-framework/02-the-container.md index 6bdf1efb..3158c3dd 100644 --- a/src/Web/Documentation/content/main/1-framework/02-the-container.md +++ b/src/Web/Documentation/content/main/1-framework/02-the-container.md @@ -1,6 +1,5 @@ --- title: Container and configuration -category: framework --- Tempest's dependency container is the heart of the framework. Anything you do framework related will be run through the container, meaning you'll have autowiring everywhere: from controllers to console commands, from event handlers to the command bus: diff --git a/src/Web/Documentation/content/main/1-framework/03-controllers.md b/src/Web/Documentation/content/main/1-framework/03-controllers.md index 74fc8370..2aff6b2e 100644 --- a/src/Web/Documentation/content/main/1-framework/03-controllers.md +++ b/src/Web/Documentation/content/main/1-framework/03-controllers.md @@ -1,6 +1,5 @@ --- title: Controllers -category: framework --- Controllers are the core of any web app, they route an HTTP request through the necessary layers of code to finally return a response. diff --git a/src/Web/Documentation/content/main/1-framework/04-views.md b/src/Web/Documentation/content/main/1-framework/04-views.md index 857cb9b9..d7a9a3e7 100644 --- a/src/Web/Documentation/content/main/1-framework/04-views.md +++ b/src/Web/Documentation/content/main/1-framework/04-views.md @@ -1,6 +1,5 @@ --- title: Views -category: framework --- Tempest supports three templating engines: Tempest View, Twig, and Blade. Tempest View is a new templating engine, while Twig and Blade have widespread support because of Symfony and Laravel. Tempest View is the default templating engine when creating Tempest projects, but the end of this page discusses how to install and switch to Twig or Blade instead. diff --git a/src/Web/Documentation/content/main/1-framework/05-models.md b/src/Web/Documentation/content/main/1-framework/05-models.md index a49e8c12..36ae411b 100644 --- a/src/Web/Documentation/content/main/1-framework/05-models.md +++ b/src/Web/Documentation/content/main/1-framework/05-models.md @@ -1,6 +1,5 @@ --- title: Models -category: framework --- In contrast to many popular ORMs, Tempest models aren't required to be tied to the database. A model's persisted data can be loaded from any kind of data source: an external API, JSON, Redis, XML, … In essence, a model is nothing more than a class with public typed properties and methods. Tempest will use a model class' type information to determine how data should be mapped between objects. diff --git a/src/Web/Documentation/content/main/1-framework/06-console.md b/src/Web/Documentation/content/main/1-framework/06-console.md index 5051d909..25de4702 100644 --- a/src/Web/Documentation/content/main/1-framework/06-console.md +++ b/src/Web/Documentation/content/main/1-framework/06-console.md @@ -1,6 +1,5 @@ --- title: Console -category: framework --- Tempest's console component can be used both within the framework, and as a standalone package. Console commands are discovered automatically by Tempest, and the framework ships with a console application in your project's root. You can call it like so: diff --git a/src/Web/Documentation/content/main/1-framework/07-events.md b/src/Web/Documentation/content/main/1-framework/07-events.md index ff978438..175023fe 100644 --- a/src/Web/Documentation/content/main/1-framework/07-events.md +++ b/src/Web/Documentation/content/main/1-framework/07-events.md @@ -1,6 +1,5 @@ --- title: Event bus -category: framework description: "Tempest comes with a built-in event bus, which can be used to dispatch events throughout your application." --- diff --git a/src/Web/Documentation/content/main/1-framework/08-commands.md b/src/Web/Documentation/content/main/1-framework/08-commands.md index 4757f4fb..9912ae18 100644 --- a/src/Web/Documentation/content/main/1-framework/08-commands.md +++ b/src/Web/Documentation/content/main/1-framework/08-commands.md @@ -1,6 +1,5 @@ --- title: Command bus -category: framework --- Tempest comes with a built-in command bus, which can be used to dispatch a command to its handler (synchronous or asynchronous). A command bus offers multiple advantages over a more direct approach to modelling processes: commands and their handlers can easily be tested in isolation, they are simple to serialize, and similar to the eventbus, the command bus also supports middleware. diff --git a/src/Web/Documentation/content/main/1-framework/09-logging.md b/src/Web/Documentation/content/main/1-framework/09-logging.md index 58ff660f..cb6a82ee 100644 --- a/src/Web/Documentation/content/main/1-framework/09-logging.md +++ b/src/Web/Documentation/content/main/1-framework/09-logging.md @@ -1,6 +1,5 @@ --- title: Logging -category: framework --- Logging is an essential part of any developer's job. Whether it's for debugging or for production monitoring. Tempest has a powerful set of tools to help you access the relevant information you need. diff --git a/src/Web/Documentation/content/main/1-framework/10-caching.md b/src/Web/Documentation/content/main/1-framework/10-caching.md index 321f7656..ead790f3 100644 --- a/src/Web/Documentation/content/main/1-framework/10-caching.md +++ b/src/Web/Documentation/content/main/1-framework/10-caching.md @@ -1,6 +1,5 @@ --- title: Caching -category: framework --- Tempest comes with a simple wrapper around PSR-6, which means you can use all PSR-6 compliant cache pools. Tempest uses [Symfony's Cache Component](https://symfony.com/doc/current/components/cache.html) as a default implementation, so all of [Symfony's adapters](https://symfony.com/doc/current/components/cache.html#available-cache-adapters) are available out of the box. diff --git a/src/Web/Documentation/content/main/1-framework/11-mapper.md b/src/Web/Documentation/content/main/1-framework/11-mapper.md index 39dfc312..1dce701c 100644 --- a/src/Web/Documentation/content/main/1-framework/11-mapper.md +++ b/src/Web/Documentation/content/main/1-framework/11-mapper.md @@ -1,6 +1,5 @@ --- title: Mapper -category: framework --- Tempest comes with a flexible mapper component that can be used to map all sorts of data to objects and back. The mapper is internally used to handle persistence between models and the database, map PSR objects to internal requests, map request data to objects, and more. diff --git a/src/Web/Documentation/content/main/1-framework/12-validation.md b/src/Web/Documentation/content/main/1-framework/12-validation.md index a91f818a..01a46b6a 100644 --- a/src/Web/Documentation/content/main/1-framework/12-validation.md +++ b/src/Web/Documentation/content/main/1-framework/12-validation.md @@ -1,6 +1,5 @@ --- title: Validation -category: framework --- Validation with Tempest is done by taking an array of raw input data, and validating whether that array of data is valid against a class. While validation and [data mapping](/main/framework/validation) often work together, the two are separate components and can also be used separately. @@ -72,4 +71,4 @@ final class Book #[SkipValidation] public string $title; } -``` \ No newline at end of file +``` diff --git a/src/Web/Documentation/content/main/1-framework/13-auth.md b/src/Web/Documentation/content/main/1-framework/13-auth.md index 6a7def5a..a386f5f2 100644 --- a/src/Web/Documentation/content/main/1-framework/13-auth.md +++ b/src/Web/Documentation/content/main/1-framework/13-auth.md @@ -1,6 +1,5 @@ --- title: Authentication and authorization -category: framework --- Logging in (authentication )and verifying whether a user is allowed to perform a specific action (authorization) are two crucial parts of any web application. Tempest comes with a built-in authenticator and authorizer, as well as a base `User` and `Permission` model (if you want to). diff --git a/src/Web/Documentation/content/main/1-framework/14-static-pages.md b/src/Web/Documentation/content/main/1-framework/14-static-pages.md index 8d460858..537d8900 100644 --- a/src/Web/Documentation/content/main/1-framework/14-static-pages.md +++ b/src/Web/Documentation/content/main/1-framework/14-static-pages.md @@ -1,6 +1,5 @@ --- title: Static pages -category: framework --- Tempest comes with a built-in static site generator. When a controller action is tagged with `#[StaticPage]`, it can be compiled by Tempest as a static HTML page. These pages can then directly be served via your webserver. diff --git a/src/Web/Documentation/content/main/1-framework/15-primitive-utilities.md b/src/Web/Documentation/content/main/1-framework/15-primitive-utilities.md index 0a9a555c..7f87996e 100644 --- a/src/Web/Documentation/content/main/1-framework/15-primitive-utilities.md +++ b/src/Web/Documentation/content/main/1-framework/15-primitive-utilities.md @@ -1,6 +1,5 @@ --- title: Primitive utilities -category: framework --- Tempest comes with a handful of classes that improve working with primitive types such as strings and arrays. The most important feature is an object-oriented API around PHP's built-in primitive helper functions. Let's take a look at what's available. diff --git a/src/Web/Documentation/content/main/1-framework/16-standalone-components.md b/src/Web/Documentation/content/main/1-framework/16-standalone-components.md index 3fe07694..697362b6 100644 --- a/src/Web/Documentation/content/main/1-framework/16-standalone-components.md +++ b/src/Web/Documentation/content/main/1-framework/16-standalone-components.md @@ -1,6 +1,5 @@ --- title: Standalone components -category: framework --- Many Tempest components can be installed as standalone packages in existing or new projects: `tempest/console`, `tempest/http`, `tempest/event-bus`, `tempest/debug`, `tempest/command-bus`, etc. diff --git a/src/Web/Documentation/content/main/1-framework/17-testing.md b/src/Web/Documentation/content/main/1-framework/17-testing.md index ea177ed3..b033e43a 100644 --- a/src/Web/Documentation/content/main/1-framework/17-testing.md +++ b/src/Web/Documentation/content/main/1-framework/17-testing.md @@ -1,6 +1,5 @@ --- title: Testing -category: framework --- Testing is a crucial part of any application. Tempest uses [PHPUnit](https://phpunit.de/) as its testing framework. diff --git a/src/Web/Documentation/content/main/2-console/02-building-console-commands.md b/src/Web/Documentation/content/main/2-console/02-building-console-commands.md index 06bb8e1f..4a6cb6cd 100644 --- a/src/Web/Documentation/content/main/2-console/02-building-console-commands.md +++ b/src/Web/Documentation/content/main/2-console/02-building-console-commands.md @@ -1,6 +1,5 @@ --- title: Building console commands -category: console --- Any method tagged with the `{php}#[ConsoleCommand]` attribute will be automatically discovered and be available within the console application. By default, you don't have to pass in any parameters to the `{php}#[ConsoleCommand]` attribute, since Tempest will use the class and method names to generate a command name: diff --git a/src/Web/Documentation/content/main/2-console/03-input-output.md b/src/Web/Documentation/content/main/2-console/03-input-output.md index 955fe169..1d1e9691 100644 --- a/src/Web/Documentation/content/main/2-console/03-input-output.md +++ b/src/Web/Documentation/content/main/2-console/03-input-output.md @@ -1,6 +1,5 @@ --- title: Input and output -category: console --- Every command can read and write from and to the terminal by injecting the `{php}Console` interface. You don't have to configure anything, Tempests takes care of injecting the right dependencies for you behind the scenes: diff --git a/src/Web/Documentation/content/main/2-console/04-components.md b/src/Web/Documentation/content/main/2-console/04-components.md index 493c636c..8ac5c14a 100644 --- a/src/Web/Documentation/content/main/2-console/04-components.md +++ b/src/Web/Documentation/content/main/2-console/04-components.md @@ -1,6 +1,5 @@ --- title: Components -category: console --- Console components are Tempest's way of providing interactivity via the console. There are a number diff --git a/src/Web/Documentation/content/main/2-console/05-scheduler.md b/src/Web/Documentation/content/main/2-console/05-scheduler.md index 2242ff1a..c365e24e 100644 --- a/src/Web/Documentation/content/main/2-console/05-scheduler.md +++ b/src/Web/Documentation/content/main/2-console/05-scheduler.md @@ -1,6 +1,5 @@ --- title: Scheduling -category: console --- `tempest/console` comes with a built-in scheduler to run commands repeatedly in the background. You can schedule console commands, as well as plain functions that aren't directly accessible via the console. diff --git a/src/Web/Documentation/content/main/2-console/06-middleware.md b/src/Web/Documentation/content/main/2-console/06-middleware.md index 78270eb9..02ab3399 100644 --- a/src/Web/Documentation/content/main/2-console/06-middleware.md +++ b/src/Web/Documentation/content/main/2-console/06-middleware.md @@ -1,6 +1,5 @@ --- title: Middleware -category: console --- `tempest/console` has support for middleware, a well known concept within the context of web applications, which also makes building a lot of console features easier. diff --git a/src/Web/Documentation/content/main/2-console/01-getting-started.md b/src/Web/Documentation/content/main/2-console/07-standalone.md similarity index 97% rename from src/Web/Documentation/content/main/2-console/01-getting-started.md rename to src/Web/Documentation/content/main/2-console/07-standalone.md index 54b3e652..888432fd 100644 --- a/src/Web/Documentation/content/main/2-console/01-getting-started.md +++ b/src/Web/Documentation/content/main/2-console/07-standalone.md @@ -1,6 +1,5 @@ --- -title: Getting started -category: console +title: Standalone --- `tempest/console` is a standalone package used to build console applications. diff --git a/src/Web/Documentation/content/main/4-internals/01-bootstrap.md b/src/Web/Documentation/content/main/3-internals/01-bootstrap.md similarity index 99% rename from src/Web/Documentation/content/main/4-internals/01-bootstrap.md rename to src/Web/Documentation/content/main/3-internals/01-bootstrap.md index 3df2ba74..ff820d14 100644 --- a/src/Web/Documentation/content/main/4-internals/01-bootstrap.md +++ b/src/Web/Documentation/content/main/3-internals/01-bootstrap.md @@ -1,6 +1,5 @@ --- title: Framework bootstrap -category: internals --- Here's a short summary of what booting Tempest looks like. diff --git a/src/Web/Documentation/content/main/4-internals/02-discovery.md b/src/Web/Documentation/content/main/3-internals/02-discovery.md similarity index 99% rename from src/Web/Documentation/content/main/4-internals/02-discovery.md rename to src/Web/Documentation/content/main/3-internals/02-discovery.md index 05ac79d9..230a0a3f 100644 --- a/src/Web/Documentation/content/main/4-internals/02-discovery.md +++ b/src/Web/Documentation/content/main/3-internals/02-discovery.md @@ -1,6 +1,5 @@ --- title: Discovery -category: internals --- Tempest has a unique design when it comes to bootstrapping an application, more specifically when it comes to loading framework related code. Instead of having to manually registering project code or packages, Tempest will scan your codebase and automatically detect code that should be loaded. This concept is called **Discovery**. diff --git a/src/Web/Documentation/content/main/4-internals/03-container.md b/src/Web/Documentation/content/main/3-internals/03-container.md similarity index 98% rename from src/Web/Documentation/content/main/4-internals/03-container.md rename to src/Web/Documentation/content/main/3-internals/03-container.md index 986ae4fe..792b95c0 100644 --- a/src/Web/Documentation/content/main/4-internals/03-container.md +++ b/src/Web/Documentation/content/main/3-internals/03-container.md @@ -1,6 +1,5 @@ --- title: The container -category: internals --- Here's a short summary of how the Tempest container works. diff --git a/src/Web/Documentation/content/main/4-internals/04-tempest-views.md b/src/Web/Documentation/content/main/3-internals/04-tempest-views.md similarity index 99% rename from src/Web/Documentation/content/main/4-internals/04-tempest-views.md rename to src/Web/Documentation/content/main/3-internals/04-tempest-views.md index b132e7b2..ef623e7b 100644 --- a/src/Web/Documentation/content/main/4-internals/04-tempest-views.md +++ b/src/Web/Documentation/content/main/3-internals/04-tempest-views.md @@ -1,6 +1,5 @@ --- title: Tempest views -category: internals --- This page describes the technical specification for Tempest views. diff --git a/src/Web/Documentation/content/main/4-internals/05-package-development.md b/src/Web/Documentation/content/main/3-internals/05-package-development.md similarity index 99% rename from src/Web/Documentation/content/main/4-internals/05-package-development.md rename to src/Web/Documentation/content/main/3-internals/05-package-development.md index c6d3cdea..decfa6d1 100644 --- a/src/Web/Documentation/content/main/4-internals/05-package-development.md +++ b/src/Web/Documentation/content/main/3-internals/05-package-development.md @@ -1,6 +1,5 @@ --- title: Package development -category: internals --- Tempest comes with a handful of tools to help third-party package developers. diff --git a/src/Web/Documentation/content/main/3-highlight/01-getting-started.md b/src/Web/Documentation/content/main/4-highlight/01-getting-started.md similarity index 99% rename from src/Web/Documentation/content/main/3-highlight/01-getting-started.md rename to src/Web/Documentation/content/main/4-highlight/01-getting-started.md index 19eea480..51079f2d 100644 --- a/src/Web/Documentation/content/main/3-highlight/01-getting-started.md +++ b/src/Web/Documentation/content/main/4-highlight/01-getting-started.md @@ -1,6 +1,5 @@ --- title: Getting started -category: highlight --- `tempest/highlight` is a package for server-side, high-performance, and flexible code highlighting. [**Give it a ⭐️ on GitHub**](https://github.com/tempestphp/highlight)! diff --git a/src/Web/Documentation/content/main/3-highlight/02-custom-language.md b/src/Web/Documentation/content/main/4-highlight/02-custom-language.md similarity index 99% rename from src/Web/Documentation/content/main/3-highlight/02-custom-language.md rename to src/Web/Documentation/content/main/4-highlight/02-custom-language.md index 5b815ea9..584c6b14 100644 --- a/src/Web/Documentation/content/main/3-highlight/02-custom-language.md +++ b/src/Web/Documentation/content/main/4-highlight/02-custom-language.md @@ -1,6 +1,5 @@ --- title: Building a custom language -category: highlight --- Let's explain how `tempest/highlight` works by implementing a new language — [Blade](https://laravel.com/docs/11.x/blade) is a good candidate. It looks something like this: diff --git a/src/Web/Documentation/content/main/3-highlight/03-adding-tokens.md b/src/Web/Documentation/content/main/4-highlight/03-adding-tokens.md similarity index 99% rename from src/Web/Documentation/content/main/3-highlight/03-adding-tokens.md rename to src/Web/Documentation/content/main/4-highlight/03-adding-tokens.md index 9b2dc776..91e03249 100644 --- a/src/Web/Documentation/content/main/3-highlight/03-adding-tokens.md +++ b/src/Web/Documentation/content/main/4-highlight/03-adding-tokens.md @@ -1,6 +1,5 @@ --- title: Adding tokens -category: highlight ---