Overview

The Guides section provides a number of step by step instructions on how to create new endpoints among other things.

Creating a new endpoint

There are a lot of repetitive steps in creating endpoints - writing lots of boiler plate code. To streamline the process and to aid in creating a more uniform code base as well as ensuring that the newest best practices are implemented, a symfony command line utility is provided to create new endpoints. It is a wizard-like command line interface that guides you through the process.

On the command line run (in the project root)

$ ./symfony api:new

Then follow the instructions at the prompt. This will generate a scaffolding file for you with the basic elements filled in for you.

Open the file in your editor of choice and look at the instructions in

  • doExecute
  • getSql
  • getAbstract
  • getDescription

As a general good practice, implement all your business logic for the endpoint in a separate class that lives in /lib/model. Look at /lib/model/handcrafted/MarketingAutomationModel.class.php for a good example.

Ideally the doExecute method will simply have code that deals with parameter acquisition and validation followed by decision logic on what method(s) to call on the model.

Deploying the application

The project requires various tasks to be performed on the target system which makes it convenient to use a deployment framework such as fabric.

You will need ssh access to the deployment target in order for this to work. You also need to install fabric.

There are two possible deployment targets:

  • dev ..... the development server located at 10.10.110.100
  • prod .... the production server located at 10.10.110.96

To deploy to development

$ fab dev deploy

To deploy to production

$ fab prod deploy

Other fabric tasks

Aside from the deploy task there are a variety of other tasks available that assist in project and deployment related issues. To see a list of available tasks

$ fab -l