Download the PHP package wobblecode/rest-bundle without Composer

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

WobbleCodeRestBundle

Quick RESTFul Apis For Symofny 3 & 4

A bundle that creates RESTful Apis in seconds, based on your current controllers actions just using annotations. This is very helpful if you need access to a basic RESTful API under the same domain or page.

A practical Case: if you're using Backbone, you can progressive enhance the functionality supporting common CRUD and One simple page CRUD enabling a quick RESTFul API…

These are the main features:

Latest Stable Version Total Downloads Travis License SensioLabsInsight

Quick Example

This is the most basic example of use. Just adding the Rest annotation, the api will be available using content negotiation. So if you request JSON, it will return a JSON format schema, If html is requested it will fallback in @Template so the related view will be rendered.

It will use JSMSerializer if it's possible in the model as well.

use WobbleCode\RestBundle\Configuration\Rest;

/**
 * @Route("/")
 * @Template()
 * @Rest()
 */
public function indexAction()
{
    ...

    return array(
        'entities' => $entity
    );
}

Example using httpie (replace your URL if needed)

http http://localhost:8000 --json

HTTP/1.1 200 OK
Cache-Control: max-age=0, must-revalidate, no-cache, no-store, public, s-maxage=0
Connection: close
Content-Type: application/json
Host: localhost:8000
X-Debug-Token: 243d5e
X-Debug-Token-Link: /_profiler/243d5e
X-Powered-By: PHP/5.5.7

{
    "entities": [...],
    "metadata": {
        "count": 10,
        "items_per_page": 10,
        "page_number": 1,
        "total_count": 244
    }
}

Setup

Add to composer

"wobblecode/rest-bundle": "dev-master",

Enable bundle in Kernel

new WobbleCode\RestBundle\WobbleCodeRestBundle()

Options

All examples shows the default values.

output

List of default objects to serialize from the returned array.

/**
 * @Rest(output={"entity", "entities", "meta"})
 */
public function indexAction()
{
    ...

    return array(
        'user'   => $user,
        'post'   => $post,
        'entity' => $entity
    );
}

Only entity value will be serialized and returned.

serializeGroups

List of groups to use with the serializer ( see JMSSerializerBundle groups ). By default will serialize all groups if not defined

/**
 * @Rest(serializeGroups={"api", "ui-admin"})
 */

acceptedContent

List of accepted headers that enables REST

/**
 * @Rest(acceptedContent={"application/json"})
 */

You will have to send Accept: application/json in order to enable the REST api functionality. If there is no match, it will fallback to the controller view.

defaultAccept

If Accept header is missing you can set a default value with defaultAccept

/**
 * @Rest(defaultAccept="application/json")
 */

If the Accept header is missing the default value is text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

payloadMapping

Defines if the payload is assigned to a POST value. This is useful because forms are usually expecting to be received under a POST variable with the name of the form Eg: $_POST['my_form_name']

/**
 * @Rest(payloadMapping="form")
 */

statusCodeParam

Parameter used to override status code response.

/**
 * @Route("/")
 * @Template()
 * @Rest(statusCodeParam="status_code")
 */
public function indexAction()
{
    ...

    return array(
        'status_code' => '403'
    );
}

versionRequired

Force to send version in Accept header if true

/**
 * @Rest(versionRequired=false)
 */

defaultVersion

Define the default version of the api, false as default for no versioning

interceptRedirects

Intercept 3xx redirects and responds with flash messages

processForms

Process forms errors

defaultFormParam

Process params with name form as principal Form for validation

Configuration

You can set serialize null property on bundle configuration.

License

Copyright (c) 2016 Luis Hdez

Released under MIT LICENSE, more info at LICENSE-MIT file.


All versions of rest-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ~7.1
symfony/framework-bundle Version ~3.0|~4.0
symfony/dependency-injection Version ~3.0|~4.0
doctrine/common Version ~2.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 wobblecode/rest-bundle contains the following files

Loading the files please wait ....