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
2 changes: 1 addition & 1 deletion admin/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ nelmio_cors:
Clear the cache to apply this change:

```console
docker-compose exec php \
docker compose exec php \
bin/console cache:clear --env=prod
```

Expand Down
2 changes: 1 addition & 1 deletion client-generator/react.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ yarn start
If you use the API Platform distribution, generating all the code you need for a given resource is as simple as running the following command:

```console
docker-compose exec client \
docker compose exec client \
generate-api-platform-client --resource book -g react
```

Expand Down
8 changes: 4 additions & 4 deletions client-generator/vuetify.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ Remove the directories `client\src\` and `client\public\` and the files `client\
Create a new Vue App and install vuetify and other vue packages:

```console
docker-compose exec client \
docker compose exec client \
vue create -d .
docker-compose exec client \
docker compose exec client \
vue add vuetify
docker-compose exec client \
docker compose exec client \
yarn add router lodash moment vue-i18n vue-router vuelidate vuex vuex-map-fields
```

Expand All @@ -45,7 +45,7 @@ Rebuild the docker containers again to install the Vue App and start the vue ser
Generate the vuetify components with the client generator:

```console
docker-compose exec client \
docker compose exec client \
generate-api-platform-client -g vuetify --resource book
```

Expand Down
2 changes: 1 addition & 1 deletion core/file-upload.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ before proceeding. It will help you get a grasp on how the bundle works, and why
Install the bundle with the help of Composer:

```console
docker-compose exec php \
docker compose exec php \
composer require vich/uploader-bundle
```

Expand Down
6 changes: 3 additions & 3 deletions core/graphql.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Once enabled, you have nothing to do: your schema describing your API is automat
To enable GraphQL and its IDE (GraphiQL and GraphQL Playground) in your API, simply require the [graphql-php](https://webonyx.github.io/graphql-php/) package using Composer and clear the cache one more time:

```console
docker-compose exec php sh -c '
docker compose exec php sh -c '
composer require webonyx/graphql-php
bin/console cache:clear
'
Expand Down Expand Up @@ -1933,14 +1933,14 @@ You may need to export your schema in SDL (Schema Definition Language) to import
The `api:graphql:export` command is provided to do so:

```shell-session
docker-compose exec php \
docker compose exec php \
bin/console api:graphql:export -o path/to/your/volume/schema.graphql
```

Since the command prints the schema to the output if you don't use the `-o` option, you can also use this command:

```shell-session
docker-compose exec php \
docker compose exec php \
bin/console api:graphql:export > path/in/host/schema.graphql
```

Expand Down
4 changes: 2 additions & 2 deletions core/json-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ The generated schema can be used with libraries such as [react-json-schema-form]
To export the schema corresponding to an API Resource, run the following command:

```console
docker-compose exec php \
docker compose exec php \
bin/console api:json-schema:generate 'App\Entity\Book'
```

To see all options available, try:

```console
docker-compose exec php \
docker compose exec php \
bin/console help api:json-schema:generate
```

Expand Down
6 changes: 3 additions & 3 deletions core/jwt.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ API Platform allows to easily add a JWT-based authentication to your API using [
We begin by installing the bundle:

```console
docker-compose exec php \
docker compose exec php \
composer require jwt-auth
```

Then we need to generate the public and private keys used for signing JWT tokens. If you're using the [API Platform distribution](../distribution/index.md), you may run this from the project's root directory:

```console
docker-compose exec php sh -c '
docker compose exec php sh -c '
set -e
apk add openssl
php bin/console lexik:jwt:generate-keypair
Expand All @@ -34,7 +34,7 @@ Note that the `setfacl` command relies on the `acl` package. This is installed b

This takes care of keypair creation (including using the correct passphrase to encrypt the private key), and setting the correct permissions on the keys allowing the web server to read them.

Since these keys are created by the `root` user from a container, your host user will not be able to read them during the `docker-compose build caddy` process. Add the `config/jwt/` folder to the `api/.dockerignore` file so that they are skipped from the result image.
Since these keys are created by the `root` user from a container, your host user will not be able to read them during the `docker compose build caddy` process. Add the `config/jwt/` folder to the `api/.dockerignore` file so that they are skipped from the result image.

If you want the keys to be auto generated in `dev` environment, see an example in the [docker-entrypoint script of api-platform/demo](https://github.com/api-platform/demo/blob/master/api/docker/php/docker-entrypoint.sh).

Expand Down
2 changes: 1 addition & 1 deletion core/messenger.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Many transports are supported to dispatch messages to async consumers, including
To enable the support of Messenger, install the library:

```console
docker-compose exec php \
docker compose exec php \
composer require messenger
```

Expand Down
4 changes: 2 additions & 2 deletions core/mongodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ If you are using the [API Platform Distribution](../distribution/index.md), modi
Then rebuild the `php` image:

```console
docker-compose build php
docker compose build php
```

Add a MongoDB image to the docker-compose file:
Expand Down Expand Up @@ -66,7 +66,7 @@ Once the extension is installed, to enable the MongoDB support, require the [Doc
package using Composer:

```console
docker-compose exec php \
docker compose exec php \
composer require doctrine/mongodb-odm-bundle
```

Expand Down
8 changes: 4 additions & 4 deletions core/openapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@ You can also dump an OpenAPI specification for your API.
OpenAPI, JSON format:

```console
docker-compose exec php \
docker compose exec php \
bin/console api:openapi:export
```

OpenAPI, YAML format:

```console
docker-compose exec php \
docker compose exec php \
bin/console api:openapi:export --yaml
```

Create a file containing the specification:

```console
docker-compose exec php \
docker compose exec php \
bin/console api:openapi:export --output=swagger_docs.json
```

If you want to use the old OpenAPI v2 (Swagger) JSON format, use:

```console
docker-compose exec php \
docker compose exec php \
bin/console api:swagger:export
```

Expand Down
4 changes: 2 additions & 2 deletions core/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ To configure Blackfire.io follow these simple steps:
4. Rebuild and restart all your containers

```console
docker-compose build
docker-compose up -d
docker compose build
docker compose up -d
```

For details on how to perform profiling, see [the Blackfire.io documentation](https://blackfire.io/docs/integrations/docker#using-the-client-for-http-profiling).
2 changes: 1 addition & 1 deletion core/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Reuse them to run, for instance, SQL queries or requests to external APIs direct
Install the `symfony/http-client` and `symfony/browser-kit` packages to enabled the API Platform test client:

```console
docker-compose exec php \
docker compose exec php \
composer require symfony/browser-kit symfony/http-client
```

Expand Down
2 changes: 1 addition & 1 deletion deployment/docker-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ SERVER_NAME=your-domain-name.example.com \
APP_SECRET=ChangeMe \
POSTGRES_PASSWORD=ChangeMe \
CADDY_MERCURE_JWT_SECRET=ChangeMe \
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
```

Be sure to replace `your-domain-name.example.com` with your actual domain name and to set the values of `APP_SECRET`, `CADDY_MERCURE_JWT_SECRET` to cryptographically secure random values.
Expand Down
2 changes: 1 addition & 1 deletion distribution/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Inspect the installation with the following command. The requested Xdebug
version should be displayed in the output.

```console
$ docker-compose exec php \
$ docker compose exec php \
php --version

PHP …
Expand Down
20 changes: 10 additions & 10 deletions distribution/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@ services using [Docker Compose](https://docs.docker.com/compose/):
Download and build the latest versions of the images:

```console
docker-compose build --pull --no-cache
docker compose build --pull --no-cache
```

Start Docker Compose in detached mode:

```console
docker-compose up -d
docker compose up -d
```

**Tip:** be sure that the ports `80`, `443` and `5432` of the host are not already in use. The usual offenders are Apache, NGINX and Postgres. If they are running, stop them and run `docker-compose up -d` again.
**Tip:** be sure that the ports `80`, `443` and `5432` of the host are not already in use. The usual offenders are Apache, NGINX and Postgres. If they are running, stop them and run `docker compose up -d` again.

This starts the following services:

Expand All @@ -107,7 +107,7 @@ The following components are available:
To see the container's logs, run:

```console
docker-compose logs -f
docker compose logs -f
```

The `-f` option is to follow the logs.
Expand Down Expand Up @@ -446,7 +446,7 @@ Modify these files as described in these patches:
**Tip**: you can also use Symfony [MakerBundle](https://symfonycasts.com/screencast/symfony-fundamentals/maker-command?cid=apip) thanks to the `--api-resource` option:

```console
docker-compose exec php \
docker compose exec php \
bin/console make:entity --api-resource
```

Expand All @@ -462,13 +462,13 @@ Now, delete the file `api/src/Entity/Greeting.php`. This demo entity isn't usefu
Finally, generate a new database migration using [Doctrine Migrations](https://symfony.com/doc/current/doctrine.html#migrations-creating-the-database-tables-schema) and apply it:

```console
docker-compose exec php \
docker compose exec php \
bin/console doctrine:migrations:diff
docker-compose exec php \
docker compose exec php \
bin/console doctrine:migrations:migrate
```

The `php` container is where your API app stands. Prefixing a command by `docker-compose exec php` allows executing the
The `php` container is where your API app stands. Prefixing a command by `docker compose exec php` allows executing the
given command in this container. You may want [to create an alias](http://www.linfo.org/alias.html) to make your life easier.

**We now have a working API with read and write capabilities!**
Expand Down Expand Up @@ -660,7 +660,7 @@ Isn't API Platform a REST **and** GraphQL framework? That's true! GraphQL suppor
need to install the [graphql-php](https://webonyx.github.io/graphql-php/) library. Run the following command:

```console
docker-compose exec php sh -c '
docker compose exec php sh -c '
composer require webonyx/graphql-php
bin/console cache:clear
'
Expand Down Expand Up @@ -750,7 +750,7 @@ API Platform also has an awesome [client generator](../client-generator/index.md
The distribution comes with a skeleton ready to welcome the [Next.js](https://nextjs.org/) flavor of the generated code. To bootstrap your app, run:

```console
docker-compose exec pwa \
docker compose exec pwa \
generate-api-platform-client
```

Expand Down
10 changes: 5 additions & 5 deletions distribution/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Before creating your functional tests, you will need a dataset to pre-populate y
First, install [Alice](https://github.com/nelmio/alice):

```console
docker-compose exec php \
docker compose exec php \
composer require --dev alice
```

Expand Down Expand Up @@ -59,7 +59,7 @@ App\Entity\Review:
You can now load your fixtures in the database with the following command:

```console
docker-compose exec php \
docker compose exec php \
bin/console hautelook:fixtures:load
```

Expand All @@ -75,8 +75,8 @@ Install the Symfony test pack (which includes PHPUnit and [PHPUnit Bridge](https
(the API Platform test client is built on top of Symfony HttpClient, and allows to leverage all its features) and [JSON Schema for PHP](https://github.com/justinrainbow/json-schema) (used by API Platform to provide [JSON Schema](https://json-schema.org/) test assertions):

```console
docker-compose exec php \
composer require --dev symfony/test-pack symfony/http-client justinrainbow/json-schema
docker compose exec php \
composer require --dev symfony/test-pack symfony/http-client justinrainbow/json-schema
```

Your API is ready to be functionally tested. Create your test classes under the `tests/` directory.
Expand Down Expand Up @@ -233,7 +233,7 @@ There is one caveat though: in some tests, it is necessary to perform multiple r
All you have to do now is to run your tests:

```console
docker-compose exec php \
docker compose exec php \
bin/phpunit
```

Expand Down
4 changes: 2 additions & 2 deletions schema-generator/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ If you use [the API Platform distribution](../distribution/index.md), the Schema
dependency of your project and can be invoked through Docker:

```console
docker-compose exec php \
docker compose exec php \
vendor/bin/schema
```

Expand Down Expand Up @@ -104,7 +104,7 @@ vendor/bin/schema generate api/src/ api/config/schema.yaml -vv
Using [the API Platform Distribution](../distribution/index.md):

```console
docker-compose exec php \
docker compose exec php \
vendor/bin/schema generate src/ config/schema.yaml -vv
```

Expand Down