Skip to content

plotkabytes/redlink-api-bundle

Repository files navigation

Redlink API Symfony Bundle

Build and tests GitHub license PRs Welcome

This repository contains simple symfony bundle for redlink-api-php-client.

Requirements

This version supports PHP >= 7.2 and Symfony >= 4.4.0.

Installation

Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.

Applications that use Symfony Flex

After getting composer you have to install PSR HTTP client implementation (if you dont have one already - for example Guzzle / Buzz):

$ composer require guzzlehttp/guzzle

Next you should install this package with usage of composer:

$ composer require --no-scripts plotkabytes/redlink-api-php-client plotkabytes/redlink-api-symfony-bundle

Applications that don't use Symfony Flex

Step 1: Download the Bundle

Procedure is the same as in "Applications that use Symfony Flex" chapter.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:

// config/bundles.php

return [
    // ...
    Plotkabytes\RedlinkApiBundle\PlotkabytesRedlinkApiBundle.php::class => ['all' => true],
];

Step 3: Configure the Bundle

Then, configure the bundle by adding following configuration to the config/packages/plotkabytes_redlink_api.yaml file:

# config/packages/plotkabytes_redlink_api.yaml
plotkabytes_redlink_api:
  clients:
    client_name:
      authorization_key: HERE_INSERT_AUTHORIZATION_KEY
      application_key: HERE_INSERT_APPLICATION_KEY
      alias: OPTIONAL_CLIENT_ALIAS
      default: false

Step 4: Clear cache

After bundle configuration may be required to clear symfony cache.

$ bin/console cache:clear

Step 5: Register service

Inside config/services.yaml add following:

# config/services.yaml
services:
  
    # ...
    # Other services
    # ...
  
    App\Controller\DefaultController:
        arguments: {$client: '@plotkabytes_redlink_api.client.default'}

Step 6: Use bundle

<?php
namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Plotkabytes\RedlinkApi;

class DefaultController extends AbstractController {

    private $client;

    public function __construct(DefaultClient $client) {
        $this->client = $client;
    }
}

Versioning

We use Semantic Versioning 2.0.0.

Given a version number MAJOR.MINOR.PATCH, increment the:

  • MAJOR version when you make incompatible API changes,
  • MINOR version when you add functionality in a backwards compatible manner, and
  • PATCH version when you make backwards compatible bug fixes.

Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

Contributing

We will gladly receive issue reports and review and accept pull requests. Feel free to contribute in any way.

Author

Mateusz Żyła mateusz.zylaa@gmail.com

License

Redlink Api Symfony Bundle is licensed under The MIT License (MIT).