Symfony

Last updated 2 months ago

Install on Symfony Application

Install Symfony Bundle

composer require 1pilotapp/symfony-client --no-scripts

The no-scripts option is required to prevent errors, because you need to setup a few configuration parameters before being able to use the bundle.

Setup Symfony 4

1. add a new config/packages/one_pilot_client.yaml file with the following content

one_pilot_client:
private_key: "%env(ONE_PILOT_PRIVATE_KEY)%"

2. add to your .env file the following parameters:

ONE_PILOT_PRIVATE_KEY=[your key]

ONE_PILOT_PRIVATE_KEY can be any random alphanumeric string. If you are not sure what key to use, go to 1Pilot dashboard and open the page to add a new site: a random key will be generated for you, and you can copy / paste it in your file. Of course you are free to create a totally different key, just make sure you have the same key in your .env and on the 1Pilot dashboard.

3. add to your config/routes.yaml the following configuration:

one_pilot:
resource: "@OnePilotClientBundle/Resources/config/routing.xml"
prefix: /

Setup Symfony 3

1. add to your app/config/config.yml file the following configuration keys:

one_pilot_client:
private_key: "%one_pilot_private_key%"

2. add to your app/config/parameters.yml.dist file the following parameter:

one_pilot_private_key: ~

This defines the new required configuration parameter.

3. add to your app/config/parameters.yml file the following parameters:

one_pilot_private_key: [your key]

one_pilot_private_key can be any random alphanumeric string. If you are not sure what key to use, go to 1Pilot dashboard and open the page to add a new site: a random key will be generated for you, and you can copy / paste it in your file. Of course you are free to create a totally different key, just make sure you have the same key in your parameters.yml and on the 1Pilot dashboard.

4. add to your app/config/routing.yml the following configuration:

one_pilot:
resource: "@OnePilotClientBundle/Resources/config/routing.xml"
prefix: /

5. add to your app/AppKernel.php file, in the registerBundles method, the following line:

...
new OnePilot\ClientBundle\OnePilotClientBundle(),
...

Advanced configuration

If your server is not at time you can have issue to connect your application to 1Pilot. For solve that edit app/config/config.ymland add skip_timestamp_validation like bellow.

one_pilot_client:
private_key: "..."
skip_timestamp_validation: true

Please note that this option will decrease security and that you should as much as possible set your server at the correct time.

‚Äč