Download the PHP package bpa/api-sandbox-bundle without Composer

On this page you can find all versions of the php package bpa/api-sandbox-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package api-sandbox-bundle

API Sandbox Bundle

This bundle is designed to prevent requests using your real controllers and responding with a fake response you defined. It integrates nicely with NelmioApiDocBundle and FOSRestBundle.

When using NelmioApiDocBundle this bundle will generate curl examples for your provided sandbox requests automatically which will show in the documentation.

Requirements

ApiSandboxBundle requires php >= 5.5 and symfony >= 2.7.

Installation

The easiest way to install this library is through composer. Just add the following lines to your composer.json file and run composer.phar update:

Configuration

Load the bundle in your AppKernel.php:

I would recommend to create a new environment for your sandbox by copying the app.php front controller to something like app_sandbox.php. In your new front controller you have to change the following line to the new environment:

Create a new config_sandbox.yml in your app/config directory with the following contents:

This takes all settings from your prod environment and enables the sandbox for your new sandbox environment.

Usage

A basic Controller

When using the FOSRestBundle and NelmioApiDocBundle for your API an integration within your application could look something like this:

Using parameters

It's possible to define multiple responses for a single Controller action and distinguish between them by using the SandboxRequest\Parameter Annotation like this:

If you now provide the parameter id = 1 the first response will be returned. With id = 2 the second one is returned and for all other requests the third response will be returned.

Automatic generation of documentation

With all this set up you will see automatically generated examples API documentation with the NelmioApiDocBundle. If you designed your own theme for your documentation you are able to provide your own ExampleGenerator which only should extend the provided ExampleGenerator and override the buildExample method:

Contributing

Please feel free to contribute to this bundle. Any contribution is highly appreciated and will be reviewed.


All versions of api-sandbox-bundle with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bpa/api-sandbox-bundle contains the following files

Loading the files please wait ....