Creating a backend bundle

Creating a new PHP bundle in a Frontastic sandboxFrontastic sandbox - A virtual machine hosted in the cloud that you can use for backend and some frontend development. They're provisioned from the developer area of the Frontastic studio. is a bit tricky due to the way the Frontastic CLIFrontastic CLI - Our Commandline Interface (CLI) that you can use for frontend development. synchronizes PHP source code (up only). It means that the newly created code on the remote host will be removed automatically due to the syncing. So, you need to follow the below steps whenever you create files in the Frontastic sandboxFrontastic sandbox - A virtual machine hosted in the cloud that you can use for backend and some frontend development. They're provisioned from the developer area of the Frontastic studio..

📘

For these steps, we're assuming that you're in the middle of development so have the Frontastic CLIFrontastic CLI - Our Commandline Interface (CLI) that you can use for frontend development. running and you're working on a Frontastic sandboxFrontastic sandbox - A virtual machine hosted in the cloud that you can use for backend and some frontend development. They're provisioned from the developer area of the Frontastic studio..

  1. Stop the Frontastic CLI (<CTRL>-<C>)

  2. SSH into your Frontastic sandboxFrontastic sandbox - A virtual machine hosted in the cloud that you can use for backend and some frontend development. They're provisioned from the developer area of the Frontastic studio. (ssh [email protected]<your-sandbox-hostname>)

  3. Change directory to the project you want to create the bundle in (cd <customer>_<project>)

  4. Run the below command to create a new bundle

./bin/console frontastic:create:bundle <YourNewBundleNameWithoutBundle>

Where <YourNewBundleNameWithoutBundle> is the name you want for your new bundle in camelCase, for example ./bin/console frontastic:create:bundle ProductAPI

The code now exists on your Frontastic sandboxFrontastic sandbox - A virtual machine hosted in the cloud that you can use for backend and some frontend development. They're provisioned from the developer area of the Frontastic studio. in the following files/directories:
- <customer>_<project>/config/bundles.php
- <customer>_<project>/src/php/<YourNewBundleNameWithoutBundle>Bundle/

Sticking with our example, the directory would be <customer>_<project>/src/php/ProductAPIBundle/

  1. Exit the Frontastic sandboxFrontastic sandbox - A virtual machine hosted in the cloud that you can use for backend and some frontend development. They're provisioned from the developer area of the Frontastic studio. (exit or <CTRL>-<D>)

  2. Copy the remote files to your local codebase using the 2 commands below (requires SCP to be installed) :

scp [email protected]<your-sandbox-hostname>:/var/www/frontastic/<customer>_<projects>/config/bundles.php <customer>_<projects>/config/bundles.php

Then:

scp -r [email protected]<your-sandbox-hostname>:/var/www/frontastic/<customer>_<projects>/src/php/<YourNewBundleNameWithoutBundle>Bundle <customer>_<projects>/src/php/
  1. Add the corresponding files to your Git project

  2. Start the Frontastic CLIFrontastic CLI - Our Commandline Interface (CLI) that you can use for frontend development. again and it will keep your files in sync


Did this page help you?