2017 © Pedro Peláez
 

project symfonys-facade

Symfonys facade for The Laravel Framework.

image

vilnius-technology/symfonys-facade

Symfonys facade for The Laravel Framework.

  • Wednesday, November 18, 2015
  • by lmikelionis
  • Repository
  • 1 Watchers
  • 1 Stars
  • 67 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

TravisBuild [Scrutinizer Code Quality] (https://scrutinizer-ci.com/g/VilniusTechnology/symfony-facade/?branch=master) CodeCoverage, (*1)

Symfonys facade for Laravel5

This package lets you use Symfony2 specific bundles inside Laravel5 application. Simply add you Symfony centric bundle to composer.json install it, configure it and enjoy it ;), (*2)

It supporst such features as:, (*3)

  • Symfony's dependency injection container that loads from standard symfony config files., (*4)

  • Route porting. Routes that are configured in routes.yml files are being accessible from Laravel., (*5)

  • Symfony commands can be executed with artisan command of from admin form., (*6)

    As this package is still in early beta, not all functions and compatibilities are tested and developed., (*7)

Installation and configuration

Add it to composer:, (*8)

$ composer require vilnius-technology/symfonys-facade dev-master, (*9)

Register pacakage

Add this to the bottom of your config\app.php in to providers key:, (*10)

  /*
  * Custom
  */
 'VilniusTechnology\SymfonysFacade\SymfonysFacadeServiceProvider',

In namespace VilniusTechnology (path: $LARVEL_PROJECT_ROOT/packages/VilniusTechnology/) create file SymfonyBundles.php, with these contents:, (*11)

``` php <?php, (*12)

namespace VilniusTechnology;

class SymfonyBundles
{
    public static function getBundles()
    {
        return [
        ];
    }
}
This is where your Symfony bundles will be registered. Familiar isn't it? :)

Add bundle loading class namespace loading to composer.json:
```json
 "psr-4": {
             "App\\": "app/",
             "VilniusTechnology\\": "packages/VilniusTechnology/"
         }

You can change it to your, but if you will follow tutorial, this is default registered bundles loader. More details in configuration section., (*13)

Now run composer dump-autoload., (*14)

Copy contents of vendor/vilnius-technology/symfony-facade/Tests/symfony/config to storage/app/symfony/config. You can do this by running command: mkdir storage/app/symfony/config ; cp -a vendor/vilnius-technology/symfonys-facade/Tests/symfony/config storage/app/symfony., (*15)

Into console run command: php artisan symfony:command 'debug:container'., (*16)

If you got a list of symfonys services, congrats. Now You can move to symfonys bundle instalations on Laravel 5.1 tutorial., (*17)

Follow this example tutorial tutorial to get know, how precisely install Symfony2 bundles, with default configuration, (*18)

As you noticed You can use symfony commands by passing them to php artisan symfony:command '$SYMFONY2_COMMAND', (*19)

Customizable configuration

First you can enter configuration parameters in app.php file., (*20)

This can be done by adding following lines to app.php file:, (*21)

    'symfonysfacade_app_dir' => 'storage/symfony', #relative to laravel app dir
    'symfonysfacade_log_dir' => 'storage/symfony/logs', #relative to laravel app dir
    'symfonysfacade_bundles' => '\VilniusTechnology\SymfonyBundles',

If you wont do that default, ones are set in $LARVEL_PROJECT_ROOT/storage/app/symfony/env ending with your projects deployment environment., (*22)

Setting symfonysfacade_app_dir - specifies symfony working directory path (where cache and config.yml files are stored). Cache and log directories will be stored there also., (*23)

Setting symfonysfacade_bundles - specifies namespace where Symfonys bundles are registered. In this case use \VilniusTechnology\SymfonyBundles, if you are following this document as tutorial. In other words namespace from:, (*24)

 "psr-4": {
            [ ... ]
            "VilniusTechnology\\": "packages/VilniusTechnology/",
            [ ... ]
         }

should be used., (*25)

In this file, you will be registering your Symfony bundles., (*26)

In path that was specified in symfonysfacade_app_dir (storage/symfony) create directory config In it you should create or copy, usual symfonys configuration files (config.yml, parameters.yml and security.yml)., (*27)

License

This bundle is under the MIT license., (*28)

Some other stuff

Probably there is natural question, why use Symfony's bundles in Laravel. Answer is: Because I wanted so... :D, (*29)

Yes for libraries, not bundles, there is no need to use such thing. But in World Wide Web there is many good bundles, that are using actual Symfony framework., (*30)

So as I wanted to use Symfony specific bundle in Laravel5 project, that I didnt saw to be ported easily. At the end of the day we have this package., (*31)

Also this facde can be usefull if in need of fast prototyping. Jus include it, register it and you have Symfony inside Laravel5 ;), (*32)

The Versions