Download the PHP package tcds-io/php-jackson-symfony without Composer

On this page you can find all versions of the php package tcds-io/php-jackson-symfony. 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 php-jackson-symfony

PHP Jackson for Symfony

Integration Test

Symfony integration for tcds-io/php-jackson, a type-safe object mapper inspired by Jackson (Java).

This package lets you:


Installation

Enable the bundle if Symfony Flex did not add it automatically:

No configuration file is needed for the attribute-based setup. Create one only when you need global mappers or custom params:


How it works

  1. Mark request DTO parameters with #[JacksonInject].
  2. Mark return values that should be serialized with #[JacksonResponse].
  3. The bundle inspects your method parameter types and PHPDoc generics.
  4. It builds those objects from:
    • Route params ({id})
    • Query / form data
    • JSON body
  5. Your return value is serialized using PHP-Jackson.

Controller-based injection & response


Invokable controllers

Symfony routes usually point to controller services. For compact endpoints, use an invokable controller:


Response status and headers


Extending Jackson configuration

The attribute-based API is the default path for request and response mapping, but the bundle also has a central configuration file for application-wide behavior. Use it to add global serialization rules and inject custom params into mapped objects.

Create config

Create the configuration file when you need global mappers or custom params:

Add global mappers

Global mappers tell Jackson to always handle a type in requests and responses without adding attributes to every controller method. They are useful when a DTO is part of your app-wide API contract, or when you want to define custom read/write behavior once instead of repeating it at each endpoint.

With a configured mapper, Jackson can read and write that type without #[JacksonInject] or #[JacksonResponse]:

Responses serialized this way use status 200 and do not support custom headers. Use #[JacksonResponse] when an endpoint needs a different status code or response headers.

Inject custom params

Custom params let you add request-scoped values that do not come from the URL, query string, form data, or JSON body. This is useful for authenticated user IDs, tenant IDs, locale, feature flags, or any value you want available while Jackson builds a request object.

Those values are merged into the data used to build Jackson objects, so a DTO can receive them like any other constructor field:


Error handling

If parsing fails, php-jackson-symfony converts a php-jackson UnableToParseValue exception into a 400 Bad Request response by default:

Set errors.request when your API needs a different response shape or status code. The handler receives an UnableToParseValue exception and must return a Symfony Response.

The UnableToParseValue exception exposes:


Development

End-to-end integration tests run a real Symfony app:


Related packages


All versions of php-jackson-symfony with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
ext-json Version *
symfony/framework-bundle Version ^8.0
tcds-io/php-jackson Version ^1.1.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 tcds-io/php-jackson-symfony contains the following files

Loading the files please wait ...