Skip to content

apitoolkit/apitoolkit-symfony

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

APItoolkit's Logo APItoolkit's Logo

Symfony SDK

APItoolkit SDK Join Discord Server APItoolkit Docs

APItoolkit is an end-to-end API and web services management toolkit for engineers and customer support teams. To integrate your Symfony (PHP) application with APItoolkit, you need to use this SDK to monitor incoming traffic, aggregate the requests, and then deliver them to the APItoolkit's servers.


Table of Contents


Installation

Kindly run the command below to install the SDK:

composer require apitoolkit/apitoolkit-symfony

Configuration

First, add the APITOOLKIT_KEY environment variable to your .env file, like so:

APITOOLKIT_KEY={ENTER_YOUR_API_KEY_HERE}

Then, add the APIToolkit\EventSubscriber\APIToolkitService listener and API Key to your config/service.yaml file, like so:

# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.

# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters:
    locale: 'en'
services:
    # default configuration for services in *this* file
    _defaults:
        autowire: true      # Automatically injects dependencies in your services.
        autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.

    APIToolkit\EventSubscriber\APIToolkitService:
      arguments:
        $apiKey: '%env(APITOOLKIT_KEY)%'

    # makes classes in src/ available to be used as services
    # this creates a service per class whose id is the fully-qualified class name
    App\:
        resource: '../src/'
        exclude:
            - '../src/DependencyInjection/'
            - '../src/Entity/'
            - '../src/Kernel.php'

    # add more service definitions when explicit configuration is needed
    # please note that last definitions always *replace* previous ones

Note

The {ENTER_YOUR_API_KEY_HERE} demo string should be replaced with the API key generated from the APItoolkit dashboard.


Important

To learn more configuration options (redacting fields, error reporting, outgoing requests, etc.), please read this SDK documentation.

Contributing and Help

To contribute to the development of this SDK or request help from the community and our team, kindly do any of the following:

License

This repository is published under the MIT license.