Download the PHP package epfremme/swagger-bundle without Composer

On this page you can find all versions of the php package epfremme/swagger-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 swagger-bundle

Swagger Bundle

Symfony 2 bundle for leveraging swagger development & testing tools

Installation

Note: This bundle should only be used in dev mode and be included as a dev only dependency. The purpose of these resources are to assist the creation of an API symfony application during development

Usage

There are 2 main bundle parameters to you can override in your parameters.yml:

  1. swagger_bundle.swagger_file default: Resources/docs/swagger.yaml - specify swagger file
  2. swagger_bundle.mock_api default: true - turn on/off to deactivate the mock API listener

More deatils on each below...

Behat Usage

Behat documentation: behat

Sample Behat Config

Sample Behat configuration using the SwaggerContext for validating json schemas

default:
    suites:
        app:
            paths:
                - %paths.base%/src/AppBundle/Tests/Features/
            contexts:
                - Epfremme\SwaggerBundle\Behat\SwaggerContext: ~
    extensions:
        Behat\Symfony2Extension: ~
        Behat\MinkExtension:
          sessions:
            default:
              symfony2: ~
    testers:
        rerun_cache: .behat_rerun_cache

Context Details

@Given I have the request payload:

Takes in a TableNode for key value pairs to be used as request payload

Format: | key | value |

@When I request :path

@When I request :path with method :method

Make a request to the API with or without a request method (defaults to GET)

@When I use the :schema schema

@When I am using the :schema schema

Store a swagger definition schema from your swagger doc to be used to validate API json response data

Note: The swagger documentation used is the file defined in the swagger_bundle.swagger_file parameter

@When I test swagger path :path

@When I test swagger path :path with operation :operation

@When I test swagger path :path with operation :operation and response :response

Store a swagger response schema from your swagger doc to be used to validate API json response data

Note: The swagger documentation used is the file defined in the swagger_bundle.swagger_file parameter

@Then the response should be json

Assert the the response is json

@Then the response json should contain key :key

Assert that the response json contains "key"

@Then the response json key :key should equal :value

Assert the response json key equals "value"

@Then The json response data should be valid

@Then The json response key :key should be valid

Validates the response data agains the previously specified swagger definition or response schema

Mock API Usage

The mock API can be disabled by setting swagger_bundle.mock_api to false. Also note the listener will not run in prod mode if you forget to move it to require-dev or added it to the wrong are of your kernel

  1. Install app/console swagger:install:mock-api
  2. Add the x-mock-api header to the request to trigger the listener to trigger the mock response

Resources

A useful chrome extension used to mock request headers Modheader

Additional chance methods & options that can be defined in the swagger.json doc chance


All versions of swagger-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
symfony/symfony Version ^2.0|^3.0
justinrainbow/json-schema Version ^2.0
tebru/realtype Version ^0.1.0
epfremme/swagger-php Version ^1.0
behat/behat Version ~3.0
behat/symfony2-extension Version ~2.0
behat/mink Version ~1.6
behat/mink-extension Version ~2.0
behat/mink-browserkit-driver Version ~1.2
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 epfremme/swagger-bundle contains the following files

Loading the files please wait ....