You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/book/v7/core-features/authentication.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ It ensures that the entity making the request has the proper credentials to acce
7
7
If it is present, the application tries to find and assign the identity to the application.
8
8
If it is not presented, Dotkernel API assigns a default `guest` identity, represented by an instance of the class `Mezzio\Authentication\UserInterface`.
9
9
Guests can access public endpoints but cannot access protected resources (those requiring user or admin roles).
10
-
Check out the Authorization page for more details on role-based access.
10
+
Check out the [Authorization page](https://docs.dotkernel.org/api-documentation/v7/core-features/authentication/) for more details on role-based access.
> Composer is required to install Dotkernel `api`.
9
+
> You can install Composer from the [official site](https://getcomposer.org/).
10
+
11
+
> Before you begin, make sure that you have navigated your command prompt to the folder where you copied the files in the previous step.
12
+
13
+
## Install Dependencies Using Composer
8
14
9
15
Run this command in the command prompt.
10
16
11
17
> Use the **CLI** to ensure interactivity for proper configuration.
18
+
> In some IDEs, Composer may not be able to prompt for configuration settings.
12
19
13
20
```shell
14
21
composer install
@@ -17,13 +24,19 @@ composer install
17
24
The automatic setup script performs these tasks:
18
25
19
26
- Installs the packages listed in the `composer.json` file and their dependencies into the `vendor` folder.
20
-
- Creates the `composer.lock` file that locks all dependencies to exact versions (you can still run `composer update` to replace them with newer versions, if available).
27
+
- Creates the `composer.lock` file that locks all dependencies to exact versions (you can still run `composer update` to replace them with newer versions, if available and installable without conflicts).
21
28
- Configures PHP CodeSniffer, a utility to detect code style errors in PHP code.
22
29
- Generate and save the OAuth2 keys in the `data/oauth` folder.
23
-
- Creates the initial `config/autoload` configuration files:
24
-
- config/autoload/local.php
25
-
- config/autoload/local.test.php
26
-
- config/autoload/mail.global.php
30
+
- Performed by this script `./bin/generate-oauth2-keys.php`.
31
+
- Creates the initial `config/autoload` configuration files.
32
+
- Performed by this script `./bin/composer-post-install-script.php`.
33
+
- These files are created:
34
+
- config/autoload/local.php
35
+
- config/autoload/local.test.php
36
+
- config/autoload/mail.global.php
37
+
38
+
> The post install commands are run automatically on every `composer install` and `composer update`.
39
+
> The scripts check if the files exist to prevent overwriting them.
27
40
28
41
You should see this text below, along with a long list of packages to be installed instead of the `[...]`.
Copy file name to clipboardExpand all lines: docs/book/v7/installation/doctrine-orm.md
+60-16Lines changed: 60 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,19 @@
1
1
# Doctrine ORM
2
2
3
-
This step saves the database connection credentials in an API configuration file.
4
-
We do not cover the creation steps of the database itself.
5
-
6
3
In this step you will:
7
4
8
-
- Create a database.
9
-
- Create and run a database migration that creates the main tables.
10
-
- Execute fixtures which populate the database with initial data.
5
+
-[Save the database connection credentials in the API configuration file](#setup-database).
6
+
-[Learn about table names prefixing](#understanding-table-names-prefixing).
7
+
-[Create a migration](#creating-migrations).
8
+
-[Run a migration](#running-migrations).
9
+
-[Executing fixtures to populate your database](#executing-fixtures).
10
+
11
+
> We do not cover the creation steps of the database itself.
11
12
12
13
## Setup database
13
14
14
-
Create a new **MariaDB**/**PostgreSQL** database and set its collation to `utf8mb4_general_ci`.
15
+
Create a new **MariaDB** or **PostgreSQL** database.
16
+
We recommend using a character set that supports UTF-8.
15
17
16
18
Make sure you fill out the database credentials in `config/autoload/local.php` under `$databases['mariadb']` or `$databases['postgresql']`.
17
19
Below is the item you need to focus on:
@@ -45,12 +47,23 @@ $databases = [
45
47
> Make sure to use the same database name when you create the database in the next step.
46
48
47
49
> If needed, you can add more database connections to this array.
48
-
> Only **one active database connection** is allowed at a time.
50
+
> Only **one active database connection** is allowed at a time, decided by the `doctrine.connection.orm_default.params` key in `config/autoload/local.php`.
49
51
50
-
> By default, the application uses the 'mariadb' connection.
51
-
> You can switch to another connection by updating `doctrine` -> `connection` -> `orm_default` -> `params`.
52
+
By default, the application uses the `mariadb` connection, as seen in the `config/autoload/local.php` file below.
53
+
You can switch to the 'postgresql' connection by commenting `'params' => $databases['mariadb']` and uncommenting `'params' => $databases['postgresql']`.
54
+
55
+
```php
56
+
'doctrine' => [
57
+
'connection' => [
58
+
'orm_default' => [
59
+
'params' => $databases['mariadb'],
60
+
// 'params' => $databases['postgresql'],
61
+
],
62
+
],
63
+
],
64
+
```
52
65
53
-
### Prefixing table names
66
+
### Understanding Table Names Prefixing
54
67
55
68
The database configuration array contains an optional key called `table_prefix`.
56
69
By default, it is an empty string, which means that all the tables will use the names specified in their respective entities, like below.
@@ -106,7 +119,13 @@ This feature helps organize databases and prevent naming conflicts if you plan o
106
119
107
120
> `doctrine_migration_versions` is an exception and will remain unchanged, since it's a special table handled only by Doctrine Migrations.
108
121
109
-
### Creating migrations
122
+
### Creating Migrations
123
+
124
+
When first installing the application, you will need to create a database migration.
125
+
Migrations are used to create and update the database schema based on the entities defined in the application.
126
+
Later, when you need to update the database schema (e.g., add/remove/edit columns), you will need to create new migrations to reflect the changes.
127
+
128
+
> Using migration files is recommended compared to manually editing the database schema because they make database changes repeatable, trackable, and safe across environments.
110
129
111
130
Create a database migration by executing the following command:
112
131
@@ -124,7 +143,12 @@ You can expect a message like this:
124
143
To revert the migration you can use migrations:execute --down "Core\\App\\Migration\\Version20260327154303"
125
144
```
126
145
127
-
### Running migrations
146
+
### Running Migrations
147
+
148
+
Running migrations is the process of applying the changes defined in the migration files to the database.
149
+
150
+
> Make sure to double-check changes before running migrations, especially when removing columns as this can result in data loss.
151
+
> The first migration should be safe, since the database is empty.
128
152
129
153
Run the database migrations by executing the following command:
130
154
@@ -160,9 +184,29 @@ If everything ran correctly, you will get this confirmation.
160
184
161
185
> The version number `YYYYMMDDHHMMSS` is the timestamp of the migration.
162
186
163
-
### Executing fixtures
164
-
165
-
**Fixtures are used to seed the database with initial values and should be executed after migrating the database.**
187
+
### Executing Fixtures
188
+
189
+
Fixtures are used to seed the database with initial values.
190
+
This basically creates the first records in the database.
191
+
192
+
> Fixtures should be executed after migrating the database to ensure the tables are created.
193
+
194
+
> You can edit the initial records if your application demands it, even after running the fixtures.
195
+
> For example, you can edit the user roles or the initial users.
196
+
197
+
> **Important**
198
+
>
199
+
> Edit the names and passwords of the initial users to prevent unauthorized users from logging into your application.
200
+
> Make sure to do so in these files:
201
+
>
202
+
> -`src/Core/src/App/Fixture/UserLoader.php`.
203
+
> -`src/Core/src/App/Fixture/AdminLoader.php`.
204
+
>
205
+
> Check for these methods and change their default parameters:
206
+
>
207
+
> -`setIdentity`.
208
+
> -`usePassword`.
209
+
> - And optionally `setFirstName` and `setLastName`.
Copy file name to clipboardExpand all lines: docs/book/v7/installation/test-the-installation.md
+13-1Lines changed: 13 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,20 @@
1
1
# Test the installation
2
2
3
+
In this final step you will:
4
+
5
+
-[Test the installation of your virtual host](#running-the-application).
6
+
-[Optionally, run a PHP built-in server](#old-way-of-doing-things-using-php-built-in-server).
7
+
8
+
3
9
> If you are getting server error 500, make sure to check the folder permissions covered in the [FAQ page](https://docs.dotkernel.org/api-documentation/v7/installation/faq/)
4
10
5
-
Sending a GET request to the home page for your virtual host should output the following message:
11
+
## Running the application
12
+
13
+
Send a GET request to the home page.
14
+
You can do so by opening a browser and navigating to your virtual host URL.
15
+
Alternatively, you can use a tool like [Bruno](https://www.usebruno.com/).
Jump to the Installation Guide from the menu to set up your first Dotkernel API application.
133
+
Jump to the [Installation Guide](https://docs.dotkernel.org/api-documentation/v7/installation/getting-started/) to set up your first Dotkernel API application.
Copy file name to clipboardExpand all lines: docs/book/v7/introduction/server-requirements.md
+5-7Lines changed: 5 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,24 @@
1
1
# Server Requirements
2
2
3
-
For production environments, we highly recommend a nix-based system (Linux, BSD, macOS).
3
+
For production environments, we highly recommend a Linux-based system.
4
4
Windows is supported for development via WSL2.
5
5
6
6
## Operating System
7
7
8
8
### Production
9
9
10
-
- Linux (CentOS, Ubuntu, Debian, AlmaLinux)
10
+
- Linux (AlmaLinux, Debian)
11
11
- BSD (FreeBSD)
12
12
- macOS (Intel or Apple Silicon)
13
13
14
14
### Development
15
15
16
-
- Windows 10/11 (via WSL2 - see WSL2 Setup Guide)
16
+
- Windows 10/11 (via WSL2 - see our [WSL2 Setup Guide](https://docs.dotkernel.org/development/v2/setup/installation/))
17
17
- macOS
18
18
- Linux
19
19
20
-
> We recommend a nix-based environment for production because of its improved performance, stability, and security hardening options compared to Windows Server.
20
+
> We recommend a Linux-based environment for production because of its improved performance, stability, and security hardening options compared to Windows Server.
21
+
> It should also work on Microsoft's IIS server with minimal modifications, but we have not tested this setup in our projects.
21
22
22
23
## Webserver
23
24
@@ -39,7 +40,6 @@ Earlier PHP versions are not supported.
39
40
40
41
### Supported PHP Configurations
41
42
42
-
- mod_php (Apache module) - Simpler setup, good for shared hosting
43
43
- FPM (FastCGI Process Manager) - Recommended for production, better performance and security isolation
44
44
- CLI SAPI (Command Line Interface) - Required for Cron jobs, migrations, and fixtures
0 commit comments