Skip to content

REDLab-Team/helpers-bundle

Repository files navigation

REDLab Helpers Bundle

A Bundle for Symfony 4+ with that provides simple PHP methods for OOP developments.

Latest Stable Version Minimum PHP Version Latest Stable Version Total Downloads

Installation

With composer :

$ composer require redlab-team/helpers-bundle

Usage

This bundle is based on the package php-helpers available on this repository.
The documentation of the helpers is in the README.md file.

Configuration

The default configuration is into the service.yml file.
It is possible to override it into the configuration of your application.

parameters:
    # This variable allow the debug logs into the helpers methods
    redlabteam_helpers_debug: true
    # This variable allow the notice logs into the helpers methods
    redlabteam_helpers_notice_failure: true
services:
    # By default the Symfony minimalist Logger is used
    # It is possible to use another logger or just edit its parameters
    logger:
        class: Symfony\Component\HttpKernel\Log\Logger
        arguments:
            $minLevel: null
            $output: '%kernel.logs_dir%/%kernel.environment%.log'
            $formatter: null

    # Below are the helpers that can be used as services
    redlabteam_helpers.array:
        class: RedlabTeam\HelpersBundle\Service\ArrayService
        arguments:
            $logger: '@logger'
            $debug: '%redlabteam_helpers_debug%'
            $noticeFailure: '%redlabteam_helpers_notice_failure%'
    RedlabTeam\HelpersBundle\Service\ArrayService: '@redlabteam_helpers.array'

    redlabteam_helpers.date:
        class: RedlabTeam\HelpersBundle\Service\DateService
        arguments:
            $logger: '@logger'
            $debug: '%redlabteam_helpers_debug%'
            $noticeFailure: '%redlabteam_helpers_notice_failure%'
    RedlabTeam\HelpersBundle\Service\DateService: '@redlabteam_helpers.date'

    redlabteam_helpers.json:
        class: RedlabTeam\HelpersBundle\Service\JsonService
        arguments:
            $logger: '@logger'
            $debug: '%redlabteam_helpers_debug%'
            $noticeFailure: '%redlabteam_helpers_notice_failure%'
    RedlabTeam\HelpersBundle\Service\JsonService: '@redlabteam_helpers.json'

    redlabteam_helpers.string:
        class: RedlabTeam\HelpersBundle\Service\StringService
        arguments:
            $logger: '@logger'
            $debug: '%redlabteam_helpers_debug%'
            $noticeFailure: '%redlabteam_helpers_notice_failure%'
    RedlabTeam\HelpersBundle\Service\StringService: '@redlabteam_helpers.string'

License

This package is released under the MIT License. See the LICENSE file for more details.