Skip to content

Commit d2aa20c

Browse files
committed
updated pages based on review
Signed-off-by: bidi <bidi@apidemia.com>
1 parent a7cebf0 commit d2aa20c

10 files changed

Lines changed: 133 additions & 46 deletions

File tree

docs/book/v7/core-features/authentication.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ It ensures that the entity making the request has the proper credentials to acce
77
If it is present, the application tries to find and assign the identity to the application.
88
If it is not presented, Dotkernel API assigns a default `guest` identity, represented by an instance of the class `Mezzio\Authentication\UserInterface`.
99
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.
1111

1212
## Configuration
1313

docs/book/v7/installation/composer.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
# Composer Installation of Packages
22

3-
Composer is required to install Dotkernel `api`. You can install Composer from the [official site](https://getcomposer.org/).
3+
In this step you will:
44

5-
> First, make sure that you have navigated your command prompt to the folder where you copied the files in the previous step.
5+
- [Install dependencies](#install-dependencies-using-composer).
6+
- [Enable development mode](#development-mode).
67

7-
## Install dependencies
8+
> 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
814

915
Run this command in the command prompt.
1016

1117
> Use the **CLI** to ensure interactivity for proper configuration.
18+
> In some IDEs, Composer may not be able to prompt for configuration settings.
1219
1320
```shell
1421
composer install
@@ -17,13 +24,19 @@ composer install
1724
The automatic setup script performs these tasks:
1825

1926
- 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).
2128
- Configures PHP CodeSniffer, a utility to detect code style errors in PHP code.
2229
- 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.
2740
2841
You should see this text below, along with a long list of packages to be installed instead of the `[...]`.
2942

docs/book/v7/installation/configuration-files.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Configuration Files
22

3-
The installation script from `composer.json` (under the key 'post-update-cmd') should have already created the files mentioned on this page.
4-
We mention them explicitly because you will need to visit them to fully configure your development environment.
3+
The post-update scripts from `composer.json` (under the key `post-update-cmd`) should have already created the files mentioned on this page.
4+
5+
> We mention these files explicitly because you will need to visit them to fully configure your development environment.
6+
> You will need to do the same for the production environment when you deploy your application.
57
68
## Prepare config files
79

docs/book/v7/installation/doctrine-orm.md

Lines changed: 60 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
# Doctrine ORM
22

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-
63
In this step you will:
74

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.
1112
1213
## Setup database
1314

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.
1517

1618
Make sure you fill out the database credentials in `config/autoload/local.php` under `$databases['mariadb']` or `$databases['postgresql']`.
1719
Below is the item you need to focus on:
@@ -45,12 +47,23 @@ $databases = [
4547
> Make sure to use the same database name when you create the database in the next step.
4648
4749
> 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`.
4951
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+
```
5265

53-
### Prefixing table names
66+
### Understanding Table Names Prefixing
5467

5568
The database configuration array contains an optional key called `table_prefix`.
5669
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
106119
107120
> `doctrine_migration_versions` is an exception and will remain unchanged, since it's a special table handled only by Doctrine Migrations.
108121
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.
110129
111130
Create a database migration by executing the following command:
112131

@@ -124,7 +143,12 @@ You can expect a message like this:
124143
To revert the migration you can use migrations:execute --down "Core\\App\\Migration\\Version20260327154303"
125144
```
126145

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.
128152
129153
Run the database migrations by executing the following command:
130154

@@ -160,9 +184,29 @@ If everything ran correctly, you will get this confirmation.
160184

161185
> The version number `YYYYMMDDHHMMSS` is the timestamp of the migration.
162186
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`.
166210
167211
To execute fixtures, run:
168212

docs/book/v7/installation/getting-started.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
# Clone the project
22

3-
## Recommended development environment
3+
In this step you will:
4+
5+
- [Clone the Dotkernel API project](#clone-the-project).
6+
- [Set file permissions](#set-file-and-folder-permissions).
47

58
> If you are using the Microsoft Windows Operating System on your machine, you can use WSL2 as a development environment.
69
> Read more about [installing and using WLS2](https://www.dotkernel.com/how-to/installing-almalinux-10-in-wsl2-php-mariadb-composer-phpmyadmin//).
710
11+
> Make sure to review the [prerequisites](prerequisites.md) before proceeding.
12+
13+
## Clone the Project
14+
815
Using your terminal, navigate inside the directory where you want to download the project files.
916

1017
> Make sure that the directory is empty before running the command below.
@@ -15,9 +22,15 @@ Run this command to clone the project files.
1522
git clone https://github.com/dotkernel/api.git .
1623
```
1724

25+
## Set File and Folder Permissions
26+
1827
To prevent future permission errors, certain folders must have their permissions set to 777.
1928
This way they assign everyone (owner, group, and other users) permissions to read, write, and execute.
2029

30+
> It is safe to set these permissions as accessing the application files is dictated by the `.htaccess` file.
31+
> The `public` folder is publicly accessible by design, so those files are served directly.
32+
> Everything else is routed to the `index.php` file.
33+
2134
```shell
2235
chmod -R 777 data
2336
chmod -R 777 public/uploads

docs/book/v7/installation/test-the-installation.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
# Test the installation
22

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+
39
> 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/)
410
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/).
16+
17+
The browser should output the following message:
618

719
```json
820
{"message": "Dotkernel API version 7"}

docs/book/v7/introduction/architecture-at-a-glance.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ The **Core** is the backbone of your application—system-level infrastructure t
1313

1414
- Authentication & Authorization: OAuth2-based authentication with RBAC (Role-Based Access Control)
1515
- Database Setup: Doctrine ORM configuration, entity definitions, and repositories
16-
- Middleware Pipeline: Request/response processing, error handling, content negotiation
1716
- Common Services: Mail service, error reporting, caching
1817
- Shared Entities: Admin/User entities, roles, permissions
1918

@@ -38,7 +37,8 @@ You spend most development time here, implementing your API's features and busin
3837

3938
## Headless CMS Architecture
4039

41-
Dotkernel API is built toward a Headless CMS architecture:
40+
Dotkernel API is built toward a Headless Platform architecture.
41+
Out of the box, it is a modular monolith that can be split into modules and microservices.
4242

4343
```quote
4444
┌──────────────────────────────────────────────────────────┐
@@ -251,11 +251,22 @@ Services are automatically resolved and injected by AttributedServiceFactory.
251251
## Standards & PSRs
252252

253253
Dotkernel API adheres to PHP standards for interoperability:
254+
Core PSRs
254255

255256
- **PSR-7**: HTTP Message Interfaces (Requests/Responses)
256257
- **PSR-11**: Container Interface (Dependency Injection)
257258
- **PSR-15**: HTTP Handlers and Middleware (Request processing)
259+
260+
Supporting PSRs, installed by dependencies:
261+
262+
- **PSR-3**: Logger Interface (Requests/Responses)
258263
- **PSR-4**: Autoloading (File organization)
264+
- **PSR-6**: Caching Interface
265+
- **PSR-13**: Link Definition Interfaces
266+
- **PSR-14**: Event Dispatcher
267+
- **PSR-17**: HTTP Factories
268+
- **PSR-18**: HTTP Client
269+
- **PSR-20**: Clock
259270

260271
This ensures your code can integrate with other PSR-compliant libraries.
261272

docs/book/v7/introduction/introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## What is Dotkernel API?
44

55
Dotkernel API is a modern, PSR-15 middleware-based REST API framework built on PHP 8.2+.
6-
It provides a headless CMS architecture with built-in OAuth2 authentication, RBAC authorization, and content negotiation out of the box.
6+
It is a Headless Platform with built-in OAuth2 authentication, RBAC authorization, and content negotiation.
77

88
## When to Use Dotkernel API
99

@@ -130,4 +130,4 @@ vendor/bin/phpunit --testsuite=FunctionalTests --testdox --colors=always
130130
## Next Steps
131131

132132
Ready to get started?
133-
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.

docs/book/v7/introduction/psr.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,3 @@ Provides a standard interface for reading the system clock.
154154
│ (Loads services automatically) │
155155
└───────────────────────────────────────────┘
156156
```
157-
158-
## Next Steps
159-
160-
- Review PSR-7 and PSR-15 in detail—these are essential for understanding Dotkernel API.
161-
- Check individual PSR pages for implementation examples.
162-
- Consider how PSRs apply to your custom code and modules.

docs/book/v7/introduction/server-requirements.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
# Server Requirements
22

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.
44
Windows is supported for development via WSL2.
55

66
## Operating System
77

88
### Production
99

10-
- Linux (CentOS, Ubuntu, Debian, AlmaLinux)
10+
- Linux (AlmaLinux, Debian)
1111
- BSD (FreeBSD)
1212
- macOS (Intel or Apple Silicon)
1313

1414
### Development
1515

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/))
1717
- macOS
1818
- Linux
1919

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.
2122
2223
## Webserver
2324

@@ -39,7 +40,6 @@ Earlier PHP versions are not supported.
3940

4041
### Supported PHP Configurations
4142

42-
- mod_php (Apache module) - Simpler setup, good for shared hosting
4343
- FPM (FastCGI Process Manager) - Recommended for production, better performance and security isolation
4444
- CLI SAPI (Command Line Interface) - Required for Cron jobs, migrations, and fixtures
4545

@@ -83,8 +83,6 @@ Tested with:
8383
Tested with:
8484

8585
- PostgreSQL 13 and above
86-
- PostgreSQL 14 (current stable)
87-
- PostgreSQL 15 (latest)
8886

8987
### Database Collation
9088

0 commit comments

Comments
 (0)