diff --git a/README.md b/README.md index 28bbf3d..f87d2d2 100644 --- a/README.md +++ b/README.md @@ -20,50 +20,34 @@ Based on Enrico Zimuel's [Zend Expressive API - Skeleton example](https://github ### Step 1: Clone the project Using your terminal, navigate inside the directory you want to download the project files into. Make sure that the directory is empty before proceeding to the download process. Once there, run the following command: -```shell -git clone https://github.com/dotkernel/api.git . -``` + git clone https://github.com/dotkernel/api.git . -### Step 2: Install project dependencies -```shell -composer install -``` -During the installation process you will be prompted: -```shell -Please select which config file you wish to inject 'Laminas\*\ConfigProvider' into: - [0] Do not inject - [1] config/config.php -Make your selection (default is 1): -``` -Please enter `0` because the application has an injected ConfigProvider which already contains the prompted configurations. -Next, you will be prompted: `Remember this option for other packages of the same type? (Y/n)` +### Step 2: Install the project -Please hit `Enter` to accept the default option, which will also leave other packages' ConfigProviders not injected. + composer install ### Step 3: Development mode If you're installing the project for development, make sure you have development mode enabled, by running: -```shell -composer development-enable -``` + + composer development-enable You can disable development mode by running: -```shell -composer development-disable -``` + + composer development-disable You can check if you have development mode enabled by running: -```shell -composer development-status -``` + + composer development-status ### Step 4: Prepare config files * duplicate `config/autoload/cors.local.php.dist` as `config/autoload/cors.local.php` <- if your API will be consumed by another application, make sure configure the `allowed_origins` * duplicate `config/autoload/local.php.dist` as `config/autoload/local.php` * duplicate `config/autoload/mail.local.php.dist` as `config/autoload/mail.local.php` <- if your API will send emails, make sure you fill in SMTP connection params +* **optional**: in order to run/create tests, duplicate `config/autoload/local.test.php.dist` as `config/autoload/local.test.php` <- this creates a new in-memory database that your tests will run on ### Step 5: Setup database @@ -72,41 +56,39 @@ composer development-status * create a new MySQL database - set collation to `utf8mb4_general_ci` * fill out the database connection params in `config/autoload/local.php` under `$databases['default']` * run the database migrations by using the following command: -```shell -php vendor/bin/doctrine-migrations migrate -``` + + + php vendor/bin/doctrine-migrations migrate + This command will prompt you to confirm that you want to run it: -```shell -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]: -``` + + 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]: + Hit `Enter` to confirm the operation. #### Executing fixtures: **Fixtures are used to seed the database with initial values and should be executed after migrating the database.** - To list all the fixtures, run: -```shell -php bin/doctrine fixtures:list -``` + + php bin/doctrine fixtures:list + This will output all the fixtures in the order of execution. To execute all fixtures, run: -```shell -php bin/doctrine fixtures:execute -``` + + php bin/doctrine fixtures:execute To execute a specific fixture, run: -```shell -php bin/doctrine fixtures:execute --class=FixtureClassName -``` + + php bin/doctrine fixtures:execute --class=FixtureClassName More details on how fixtures work can be found here: https://github.com/dotkernel/dot-data-fixtures#creating-fixtures ### Step 6: Test the installation -```shell -php -S 0.0.0.0:8080 -t public -``` + + php -S 0.0.0.0:8080 -t public + Sending a GET request to the [home page](http://localhost:8080/) should output the following message: ```json {