Download the PHP package visual-craft/rest-base-bundle without Composer

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

RestBase Bundle

Symfony Bundle which provides base foundation for REST API applications. Features include:

Installation

Step 1: Install the bundle

$ composer require visual-craft/rest-base-bundle

Step 2: Enable the bundle

If you are not using Flex, you also have to enable the bundle by adding the following line in the app/AppKernel.php:

Serializer

By default, additional attributes that are not mapped to the denormalized object will be ignored by the Serializer component. If you prefer to throw an exception when this happens, set the allow_extra_attributes context option to false:

Errors

Configuration

Using the zone configuration, you can specify zones of application where error converter enabled.

Example:

Supported exceptions

Symfony\Component\Security\Core\Exception\AuthenticationException

All authentication exceptions.

Response body:


Symfony\Component\HttpKernel\Exception\HttpExceptionInterface

HTTP error exceptions.

Response body:

Previous exceptions before HttpException:

Response body:

Response body:


VisualCraft\RestBaseBundle\Problem\ExceptionToProblemConverters\InsufficientAuthenticationException

Thrown if the user credentials are not sufficiently trusted. This is the case when a user is anonymous and the resource to be displayed has an access role.

Response body:


(Deprecated since v0.3) VisualCraft\RestBaseBundle\Exceptions\InvalidRequestException

Base exception thrown if request body are invalid.

Response body:


(Deprecated since v0.3) VisualCraft\RestBaseBundle\Exceptions\InvalidRequestBodyFormatException

Extends from InvalidRequestException. Thrown when symfony/serializer can't deserialize request body.

Response body:

"cause" field values:

Extends from InvalidRequestException. Thrown when no content type parameter are not pointed or content type have unsupported value.

Response body:

"code" field values:

Response body:


Symfony\Component\Serializer\Exception\ExtraAttributesException

Response body:


Symfony\Component\Serializer\Exception\UnexpectedValueException

Response body:

Enable support security exceptions

If you use separate firewall for your API, use VisualCraft\RestBaseBundle\Security\AuthenticationEntryPoint

If you want to use your custom entry point class, please edit your class next way:

If Authenticator is used in API, use VisualCraft\RestBaseBundle\Security\AuthenticationFailureHandler for auth error converting

Support custom exception

You can create and add your own exceptions and convertors for them.

Request Body Deserializer

Api Body Deserializer contains:

Example:

Content type configuration

Debug

To enable exception stack trace in error response body needed to change config:

Error response example:

Failing Validator

Bundle also provides Failing Validator which validates your data. In case of validation violations it throws exception which are supported by Exception converter, so you will receive structured response when data is not valid:

Tests

Additional Tools

License

This bundle is released under the MIT license. See the complete license in the file: LICENSE


All versions of rest-base-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4 || >=8.2
phpdocumentor/reflection-docblock Version ^5.3
phpstan/phpdoc-parser Version ^1.4
symfony/framework-bundle Version ^5.4 || ^6.0 || ^7.0
symfony/property-access Version ^5.4 || ^6.0 || ^7.0
symfony/property-info Version ^5.4 || ^6.0 || ^7.0
symfony/security-bundle Version ^5.4 || ^6.0 || ^7.0
symfony/serializer Version ^5.4 || ^6.0 || ^7.0
symfony/validator Version ^5.4 || ^6.0 || ^7.0
symfony/yaml Version ^5.4 || ^6.0 || ^7.0
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 visual-craft/rest-base-bundle contains the following files

Loading the files please wait ....