Skip to content

Commit 7dcb9e5

Browse files
authored
Merge pull request #4 from dotkernel/arhimede
reorganize the documentation items
2 parents e1f34be + 8939d52 commit 7dcb9e5

8 files changed

Lines changed: 168 additions & 111 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Composer Installation of Packages
2+
3+
## Install dependencies
4+
5+
```shell
6+
composer install
7+
```
8+
9+
## Development mode
10+
11+
If you're installing the project for development, make sure you have development mode enabled, by running:
12+
13+
```shell
14+
composer development-enable
15+
```
16+
17+
You can disable development mode by running:
18+
19+
```shell
20+
composer development-disable
21+
```
22+
23+
You can check if you have development mode enabled by running:
24+
25+
```shell
26+
composer development-status
27+
```
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Configuration Files
2+
3+
## Prepare config files
4+
5+
* duplicate `config/autoload/cors.local.php.dist` as `config/autoload/cors.local.php`
6+
#### Note
7+
> if your API will be consumed by another application, make sure to configure the `allowed_origins` variable
8+
9+
* duplicate `config/autoload/local.php.dist` as `config/autoload/local.php`
10+
11+
* duplicate `config/autoload/mail.local.php.dist` as `config/autoload/mail.local.php`
12+
13+
### Note
14+
> if your API will send emails, make sure to fill in SMTP connection params
15+
16+
17+
* **optional**: in order to run/create tests, duplicate `config/autoload/local.test.php.dist` as `config/autoload/local.test.php`
18+
19+
### Note
20+
> this creates a new in-memory database that your tests will run on.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Doctrine ORM
2+
3+
## Setup database
4+
5+
Make sure you fill out the database credentials in `config/autoload/local.php` under `$databases['default']`.
6+
7+
Create a new MySQL database - set collation to `utf8mb4_general_ci`
8+
9+
## Running migrations
10+
11+
Run the database migrations by using the following command:
12+
13+
```shell
14+
php vendor/bin/doctrine-migrations migrate
15+
```
16+
17+
This command will prompt you to confirm that you want to run it.
18+
19+
> WARNING! You are about to execute a migration in database "..." that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
20+
21+
Hit `Enter` to confirm the operation.
22+
23+
## Executing fixtures
24+
25+
**Fixtures are used to seed the database with initial values and should be executed after migrating the database.**
26+
27+
To list all the fixtures, run:
28+
29+
```shell
30+
php bin/doctrine fixtures:list
31+
```
32+
33+
This will output all the fixtures in the order of execution.
34+
35+
To execute all fixtures, run:
36+
37+
```shell
38+
php bin/doctrine fixtures:execute
39+
```
40+
41+
To execute a specific fixture, run:
42+
43+
```shell
44+
php bin/doctrine fixtures:execute --class=FixtureClassName
45+
```
46+
47+
More details on how fixtures work can be found here: https://github.com/dotkernel/dot-data-fixtures#creating-fixtures

docs/book/v4/installation/faq.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Frequently Asked Questions
2+
3+
## How do I fix common permission issues?
4+
5+
If running your project you encounter some permission issues, follow the below steps.
6+
7+
### Errors:
8+
9+
> PHP Fatal error: Uncaught InvalidArgumentException: The directory "/var/www/_example.local_/html/data" is not writable...
10+
11+
> PHP Fatal error: Uncaught InvalidArgumentException: The directory "/var/www/_example.local_/html/data/cache" is not writable...
12+
13+
> PHP Fatal error: Uncaught InvalidArgumentException: The directory "/var/www/_example.local_/html/data/cache/doctrine" is not writable...
14+
15+
**Fix:**
16+
17+
```shell
18+
chmod -R 777 data
19+
20+
### Error:
21+
22+
> PHP Fatal error: Uncaught InvalidArgumentException: The directory "/var/www/_example.local_/html/public/uploads" is not writable...
23+
24+
**Fix:**
25+
26+
```shell
27+
chmod -R 777 public/uploads
28+
29+
### Error:
30+
31+
> PHP Fatal error: Uncaught ErrorException: fopen(/var/www/_example.local_/config/autoload/../../log/error-log-_yyyy-mm-dd.log_): Failed to open stream: Permission denied...
32+
33+
**Fix:**
34+
35+
```shell
36+
chmod -R 777 log
File renamed without changes.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Test the installation
2+
3+
Sending a GET request to the [home page](http://0.0.0.0:8080/) should output the following message:
4+
5+
> {"message": "Welcome to DotKernel API!"}
6+
7+
## Old way of doing things, using PHP built-in server
8+
9+
```shell
10+
php -S 0.0.0.0:8080 -t public
11+
```
12+
13+
## Running tests
14+
15+
The project has 2 types of tests: functional and unit tests, you can run both types at the same type by executing this command:
16+
17+
```shell
18+
php vendor/bin/phpunit
19+
```
20+
21+
## Running unit tests
22+
23+
```shell
24+
vendor/bin/phpunit --testsuite=UnitTests --testdox --colors=always
25+
```
26+
27+
## Running functional tests
28+
29+
```shell
30+
vendor/bin/phpunit --testsuite=FunctionalTests --testdox --colors=always
31+
```

docs/book/v4/introduction/installation.md

Lines changed: 0 additions & 109 deletions
This file was deleted.

mkdocs.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@ nav:
1010
- v4:
1111
- Introduction:
1212
- "Introduction": v4/introduction/introduction.md
13-
- "Getting Started": v4/introduction/getting-started.md
1413
- "Server Requirements": v4/introduction/server-requirements.md
1514
- "File Structure": v4/introduction/file-structure.md
16-
- "Installation": v4/introduction/installation.md
1715
- "Packages": v4/introduction/packages.md
16+
- Installation:
17+
- "Getting Started": v4/installation/getting-started.md
18+
- "Composer": v4/installation/composer.md
19+
- "Configuration Files": v4/installation/configuration-files.md
20+
- "Doctrine ORM": v4/installation/doctrine-orm.md
21+
- "Test the Installation": v4/installation/test-the-installation.md
22+
- "FAQ": v4/installation/faq.md
1823
- Tutorials:
1924
- "Creating a book module": v4/tutorials/create-book-module.md
2025
- Transition from API Tools:

0 commit comments

Comments
 (0)