Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/contribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To encourage active collaboration, Platine strongly encourages pull requests, no

However, if you fill a bug report, your issue should contain a title and a clear description of the issue. You should also include as much relevant information as possible and a code sample that demonstrates the issue. The goal of a bug report is to make it easy for yourself - and others - to replicate the bug and develop a fix.

Remember, bug reports are created in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the bug report will automatically see any activity or that others will jump to fix it. Creating a bug report serves to help yourself and others start on the path of fixing the problem. If you want to chip in, you can help out by fixing [any bugs listed in our issue trackers](https://github.com/platine-php/app/issues). You must be authenticated with GitHub to view all of issues.
Remember, bug reports are created in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the bug report will automatically see any activity or that others will jump to fix it. Creating a bug report serves to help yourself and others start on the path of fixing the problem. If you want to chip in, you can help out by fixing [any bugs listed in our issue trackers](https://github.com/platine-php/framework/issues). You must be authenticated with GitHub to view all of issues.

The Platine source code is managed on GitHub, and there are repositories for each of the Platine packages:

Expand All @@ -21,8 +21,8 @@ The Platine source code is managed on GitHub, and there are repositories for eac
- [Platine Container](https://github.com/platine-php/container)
- [Platine Cookie](https://github.com/platine-php/cookie)
- [Platine Database](https://github.com/platine-php/database)
- [Platine Docx template](https://github.com/platine-php/docx-template)
- [Platine Event dispatcher](https://github.com/platine-php/event-dispatcher)
- [Platine Docx Template](https://github.com/platine-php/docx-template)
- [Platine Event Dispatcher](https://github.com/platine-php/event-dispatcher)
- [Platine Filesystem](https://github.com/platine-php/filesystem)
- [Platine Framework](https://github.com/platine-php/framework)
- [Platine HTTP](https://github.com/platine-php/http)
Expand All @@ -32,14 +32,14 @@ The Platine source code is managed on GitHub, and there are repositories for eac
- [Platine ORM](https://github.com/platine-php/orm)
- [Platine Pagination](https://github.com/platine-php/pagination)
- [Platine PDF](https://github.com/platine-php/pdf)
- [Platine Request handler](https://github.com/platine-php/request-handler)
- [Platine Request Handler](https://github.com/platine-php/request-handler)
- [Platine Router](https://github.com/platine-php/router)
- [Platine Security](https://github.com/platine-php/security)
- [Platine Session](https://github.com/platine-php/session)
- [Platine Standard library](https://github.com/platine-php/stdlib)
- [Platine Standard Library](https://github.com/platine-php/stdlib)
- [Platine Template](https://github.com/platine-php/template)
- [Platine Upload](https://github.com/platine-php/upload)
- [Platine User agent](https://github.com/platine-php/user-agent)
- [Platine User Agent](https://github.com/platine-php/user-agent)
- [Platine Validator](https://github.com/platine-php/validator)

## Support Questions
Expand All @@ -52,7 +52,7 @@ Platine's GitHub issue trackers are not intended to provide Platine help or supp

## Core Development Discussion

You may propose new features or improvements of existing Platine behavior in the Platine framework repository's [GitHub discussion board](https://github.com/platine-php/app/discussions). If you propose a new feature, please be willing to implement at least some of the code that would be needed to complete the feature.
You may propose new features or improvements of existing Platine behavior in the Platine framework repository's [GitHub discussion board](https://github.com/platine-php/framework/discussions). If you propose a new feature, please be willing to implement at least some of the code that would be needed to complete the feature.

Informal discussion regarding bugs, new features, and implementation of existing features takes place in the `#internals` channel of the [Platine Slack](https://platineframework.slack.com). Tony NGUEREZA, the maintainer of Platine, is typically present in the channel on weekdays from 8am-5pm (UTC+01:00 or Africa/Bangui), and sporadically present in the channel at other times.

Expand Down Expand Up @@ -94,7 +94,7 @@ public function isLogged(int $id): bool
}
```

::: danger
::: warning
Each PHP file must start with the declaration `declare(strict_types=1);`
:::

Expand Down
6 changes: 3 additions & 3 deletions src/general/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ $app->bind(ErrorHandlerInterface::class, function (ContainerInterface $app) {
return new ErrorHandler($app->get(LoggerInterface::class));
});
```
!!! important
You need to bind classes into the container before use it. The container does not need to be instructed on how to build these objects if their dependencies are concrete, since it can automatically resolve these objects using reflection.

::: warning
You need to bind classes into the container before use it. The container does not need to be instructed on how to build these objects if their dependencies are concrete, since it can automatically resolve these objects using reflection.
:::
#### Binding A Singleton

The `share` method binds a class or interface into the container that should only be resolved one time. Once a singleton binding is resolved, the same object instance will be returned on subsequent calls into the container:
Expand Down
4 changes: 2 additions & 2 deletions src/general/lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ The goal of this document is to give you a good, high-level overview of how the

The entry point for all requests to a Platine application is the `public/index.php` file. All requests are directed to this file by your web server (Apache / Nginx) configuration. The `index.php` file doesn't contain much code. Rather, it is a starting point for loading the rest of the framework.

The `index.php` file loads the Composer generated autoloader definition, and then create an instance of the Platine application from `Platine\Framework\App\Application`. The first action taken by Platine itself is to create an instance of the application / [container](container.md).
The `index.php` file loads the Composer generated autoloader definition, and then create an instance of the Platine application from `Platine\Framework\App\Application`. The first action taken by Platine itself is to create an instance of the application/[container](container.md).

### HTTP / Console Kernels

Next, the incoming request is sent to either the HTTP kernel or the console kernel, depending on the type of request that is entering the application. These two kernels serve as the central location that all requests flow through. For now, let's just focus on the HTTP kernel, which is located in `Platine\Framework\Kernel\HttpKernel`.

The HTTP kernel extends the `Platine\Framework\Kernel\BaseKernel` class and implements ``Platine\Http\Handler\RequestHandlerInterface`, which contains the method `bootstrap` that will be run before the request is executed. The `bootstrap` method configure error handling, configure logging, detect the application environment, and perform other tasks that need to be done before the request is actually handled. Typically, these classes handle internal Platine configuration that you do not need to worry about.
The HTTP kernel extends the `Platine\Framework\Kernel\BaseKernel` class and implements `Platine\Http\Handler\RequestHandlerInterface`, which contains the method `bootstrap` that will be run before the request is executed. The `bootstrap` method configure error handling, configure logging, detect the application environment, and perform other tasks that need to be done before the request is actually handled. Typically, these classes handle internal Platine configuration that you do not need to worry about.

The HTTP kernel also defines a list of HTTP [middleware](../overview/middleware.md) that all requests must pass through before being handled by the application. These middleware handle reading and writing the HTTP session, by verifying the CSRF token, and more. We'll talk more about these soon.

Expand Down
35 changes: 28 additions & 7 deletions src/general/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ If you open the `config/providers.php` file included with Platine, you will see

In this overview, you will learn how to write your own service providers and register them with your Platine application.

!!! tips
If you would like to learn more about how Platine handles requests and works internally, check out our documentation on the Platine [lifecycle](lifecycle.md).
::: tip Note
If you would like to learn more about how Platine handles requests and works internally, check out our documentation on the Platine [lifecycle](lifecycle.md).
:::

## Writing Service Providers

Expand All @@ -39,7 +40,6 @@ public function register(): void
```



This service provider only defines a `register` method, and uses that method to define an implementation of `Platine\Lang\Translator\TranslatorInterface` in the service container. If you're not yet familiar with Platine's service container, check out [its documentation](container.md).

### The Boot Method
Expand Down Expand Up @@ -92,11 +92,31 @@ public function boot(): void
$this->addCommand(MyCommand::class);
}
```
!!! important
The parameter should be the full class name that is binding to container or the class without constructor parameters that can be created using `new Mycommand()`
::: tip Important
The parameter should be the full class name that is binding to container or the class without constructor parameters that can be created using `new Mycommand()`.
:::

For more details see [Console application](../advanced/console.md).

### The addTask Method

If you want add tasks, this should be done using the `addTask ` method:

```php
<?php
/**
* {@inheritdoc}
*/
public function boot(): void
{
$this->addTask(MyTask::class);
}
```
::: tip Important
The parameter should be the full class name that is binding to container or the class without constructor parameters that can be created using `new MyTask()`.
:::

For more details see [Console application](../advanced/console.md).

### The listen Method

Expand All @@ -114,8 +134,9 @@ public function boot(): void
```

So when the event `MyEvent::class` is fired the listener `MyListener::class` will be called.
!!! important
If the listener parameter is a string this should be the full class name that is binding to container or the class without constructor parameters that can be created using `new MyListener()`
::: tip Important
If the listener parameter is a string this should be the full class name that is binding to container or the class without constructor parameters that can be created using `new MyListener()`.
:::

See [Events](../advanced/events.md) for more details.

Expand Down
2 changes: 1 addition & 1 deletion src/getting-started/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The `Console` directory contains all of the custom Platine commands for your app

#### The Exception Directory

The `Exception` directory contains your application's exception and is also a good place to place any exceptions thrown by your application. In this directory you already have the application base exception class `Platine\App\Exception\ApplicationException`, it's recommended that all the application extend this base class.
The `Exception` directory contains your application's exception and is also a good place to place any exceptions thrown by your application. In this directory you already have the application base exception class `Platine\App\Exception\ApplicationException`, it's recommended that all the application Exception extend this base class.

#### The Http Directory

Expand Down
12 changes: 7 additions & 5 deletions src/getting-started/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Platine's default `.env` file contains some common configuration values that may

If you are developing with a team, you may wish to continue including a `.env.example` file with your application. By putting placeholder values in the example configuration file, other developers on your team can clearly see which environment variables are needed to run your application.

!!! note
Any variable in your `.env` file can be overridden by external environment variables such as server-level or system-level environment variables.

::: tip Note
Any variable in your `.env` file can be overridden by external environment variables such as server-level or system-level environment variables.
:::
#### Environment File Security

All variables in your `.env` files are typically parsed as strings, so some reserved values have been created to allow you to return a wider range of types from the `env()` helper function:
Expand Down Expand Up @@ -108,8 +108,10 @@ The `debug` option in your `config/app.php` configuration file determines how mu

For local development, you should set the `PL_APP_DEBUG` environment variable to `true`. **In your production environment, this value should always be `false`. If the variable is set to `true` in production, you risk exposing sensitive configuration values to your application's end users.**

!!! tips
`Platine\Config\Config` implements `ArrayAccess` so you can easily access or set the configuration values using array direct access, see example below:
::: tip Note
`Platine\Config\Config` implements `ArrayAccess` so you can easily access or set the configuration values using array direct access.
:::
See example below:

```php
<?php
Expand Down
6 changes: 3 additions & 3 deletions src/getting-started/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ When deploying to production, make sure that you are optimizing Composer's class
```
composer install --optimize-autoloader --no-dev
```
!!! tips
In addition to optimizing the autoloader, you should always be sure to include a `composer.lock` file in your project's source control repository. Your project's dependencies can be installed much faster when a `composer.lock` file is present.

::: tip
In addition to optimizing the autoloader, you should always be sure to include a `composer.lock` file in your project's source control repository. Your project's dependencies can be installed much faster when a `composer.lock` file is present.
:::
### Optimizing Template Rendering

When deploying your application to production, you should make sure that your template files is cached, see `Platine\Template\Template` for more detail regarding how to use cache.
Expand Down
11 changes: 6 additions & 5 deletions src/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ Since many of Platine's configuration option values may vary depending on whethe

Your `.env` file should not be committed to your application's source control, since each developer / server using your application could require a different environment configuration. Furthermore, this would be a security risk in the event an intruder gains access to your source control repository, since any sensitive credentials would get exposed.

!!! info
For more information about the `.env` file and environment based configuration, check out the full [configuration](configuration.md).

::: tip Info
For more information about the `.env` file and environment based configuration, check out the full [configuration](configuration.md).
:::
### Directory Configuration

Platine should always be served out of the root of the "web directory" configured for your web server. You should not attempt to serve a Platine application out of a subdirectory of the "web directory". Attempting to do so could expose sensitive files that exist within your application. Only `public` directory must be "web directory" of your application.
Expand All @@ -55,8 +55,9 @@ Platine may serve as a full stack framework. By "full stack" framework we mean t

If this is how you plan to use Platine, you may want to check out our documentation on [routing](../overview/routing.md), [templates](../overview/template.md), or the [ORM](../orm/getting-started.md).

!!! tips
If you want to get a head start building your application, check out one of our official [application starter](starter-project.md).
::: tip Note
If you want to get a head start building your application, check out one of our official [application starter](starter-project.md).
:::

### The API Backend

Expand Down
6 changes: 3 additions & 3 deletions src/overview/action.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,6 @@ class WelcomeAction implements RequestHandlerInterface

So the `Template` and `Application` dependencies will be resolved automatically.

!!! note
These constructor's dependencies must to be binding in container first.

::: tip Note
These constructor's dependencies must to be binding in container first.
:::
17 changes: 9 additions & 8 deletions src/overview/middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ As you can see, if the given `token` does not match our secret token, the middle

It's best to envision middleware as a series of "layers" HTTP requests must pass through before they hit your application. Each layer can examine the request and even reject it entirely.

!!! tips
All middleware are resolved via the [service container](../general/container.md), so you may type-hint any dependencies you need within a middleware's constructor.

::: tip Important
All middleware are resolved via the [service container](../general/container.md), so you may type-hint any dependencies you need within a middleware's constructor.
:::
#### Middleware & Responses

Of course, a middleware can perform tasks before or after passing the request deeper into the application. For example, the following middleware would perform some task **before** the request is handled by the application:
Expand Down Expand Up @@ -98,13 +98,14 @@ class DemoMiddleware implements MiddlewareInterface
}
```

!!! note
A middleware can return an response if condition meet before the request reach the application itself.
::: tip Note
A middleware can return an response if condition meet before the request reach the application itself.
:::

## Registering Middleware

If you want a middleware to run during every HTTP request to your application, list the middleware class in the `config/middlewares.php` array.

!!! important
The order is important when registering a middleware, the execution will beginning from the first to last.

::: warning
The order is important when registering a middleware, the execution will beginning from the first to last.
:::
6 changes: 3 additions & 3 deletions src/overview/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ class WelcomeAction implements RequestHandlerInterface

So the `Template` and `Application` dependencies will be resolved automatically.

!!! note
These constructor's dependencies must to be binding in container first.

::: tip Note
These constructor's dependencies must to be binding in container first.
:::
## Route Parameters

Sometimes you will need to capture segments of the URI within your route. For example, you may need to capture a user's ID from the URL. You may do so by defining route parameters:
Expand Down
6 changes: 3 additions & 3 deletions src/overview/session.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,9 @@ Sometimes you may wish to store items in the session for the next request. You m
}
}
```
!!! tips
Session key can be used with "dot" notation.

::: tip Note
Session key can be used with "dot" notation.
:::
## Adding Custom Session Drivers

#### Implementing The Driver
Expand Down
12 changes: 6 additions & 6 deletions src/overview/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ Will output something like:

`Hello, Tony`

!!! note
Looking for more information on how to write templates? Check out the full [Template documentation](../packages/template.md) to get started.

::: tip Note
Looking for more information on how to write templates? Check out the full [Template documentation](../packages/template.md) to get started.
:::
## Creating & Rendering Template

You may create a template by placing a file with the `.html` extension (is configurable) in your application's `storage/resource/templates` directory. Platine templates contain HTML as well as directives that allow you to easily echo values, create "if" statements, iterate over data, and more.
Expand Down Expand Up @@ -179,9 +179,9 @@ class DemoAction
}
```

!!! important
In the rest of documentation we will use `TemplateResponse` for examples, but you can adapt it to use template engine.

::: tip
In the rest of documentation we will use `TemplateResponse` for examples, but you can adapt it to use template engine.
:::
## Passing Data To Template

As you saw in the previous examples, you may pass an array of data to template to make that data available to the it:
Expand Down
Loading