Symfony usage

In order to use JsonMapper with your Symfony application you only need JsonMapper’s SymfonyBundle.

The installation of JsonMapper Symfony package can easily be done with Composer

$ composer require json-mapper/symfony-bundle

The example shown above assumes that composer is on your $PATH.

Now JsonMapper will be automatically injected if it is provided as one of the constructor arguments.


namespace App\Service;

use JsonMapper\JsonMapper;

class ApiClient
    /** @var JsonMapper */
    private $mapper;
    public function __construct(JsonMapper $mapper)
        $this->mapper = $mapper;