2017 © Pedro Peláez
 

library symfony-assets

A list of PHP classes that will help you develop fast & easy various APIs.

image

mindlahus/symfony-assets

A list of PHP classes that will help you develop fast & easy various APIs.

  • Monday, February 19, 2018
  • by mindlahus
  • Repository
  • 1 Watchers
  • 0 Stars
  • 332 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 100 Versions
  • 0 % Grown

The README.md

Symfony Assets

A list of PHP classes that will help you develop fast & easy various API's., (*1)

You are strongly encouraged to install nelmio/cors-bundle., (*2)

composer require nelmio/cors-bundle

Symfony services

Simfony Assets provides multiple services. Here is the list of all available services:, (*3)

  • Download Service.
  • Database Export Service.
  • Exception Listener.

Just add the following lines inside app/config/services.yml:, (*4)

    mindlahus.v4.download_service:
        class: Mindlahus\SymfonyAssets\Service\DownloadService
        arguments: ["@service_container"]
    mindlahus.v4.database_export_service:
        class: Mindlahus\SymfonyAssets\Service\DatabaseExportService
        arguments: ["@service_container"]
    mindlahus.v4.exception_listener:
            class: Mindlahus\SymfonyAssets\EventListener\ExceptionListener
            tags:
                - { name: kernel.event_listener, event: kernel.exception, method: onKernelException }
    auth0.v4.jwt_auth_bundle:
        class: Mindlahus\SymfonyAssets\Security\A0UserProvider
        arguments: ["@jwt_auth.auth0_service", '%jwt_auth.domain%']

Integrating gedmo/doctrine-extensions

The easiest way of connecting this to your app is by simple copy/paste. See src/Resources/config/doctrine_extensions.yml., (*5)

    gedmo.listener.timestampable:
        class: Gedmo\Timestampable\TimestampableListener
        tags:
            - { name: doctrine.event_subscriber, connection: default }
        calls:
            - [ setAnnotationReader, [ "@annotation_reader" ] ]

    gedmo.listener.blameable:
        class: Gedmo\Blameable\BlameableListener
        tags:
            - { name: doctrine.event_subscriber, connection: default }
        calls:
            - [ setAnnotationReader, [ "@annotation_reader" ] ]

In case you use Auth0 and still want to make use of blameable a solution is to using the DoctrineExtensionListener.
This will help you connect your local User to the user profile made available by Auth0 after login., (*6)

To connect the listener to your app, just copy/paste the following snippet., (*7)

    mindlahus.v4.doctrine_extension_listener:
        class: Mindlahus\SymfonyAssets\Listener\DoctrineExtensionListener
        calls:
            - [ setContainer, [ "@service_container" ] ]
            - [ setUserRepository, [ "AppBundle:User" ] ]
        tags:
            # loggable hooks user username if one is in security context
            - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }

Monolog configuration

monolog:
    channels: [onew]
    handlers:
        onew:
            # log all messages (since debug is the lowest level)
            level:    debug
            type:     stream
            path:     '%kernel.logs_dir%/onew.log'
            channels: [onew]

The Versions