2017 © Pedro Peláez
 

library modules

Nette modules on the Steroids

image

flame/modules

Nette modules on the Steroids

  • PHP
  • 7 Dependents
  • 1 Suggesters
  • 7 Forks
  • 3 Open issues
  • 13 Versions
  • 3 % Grown

The README.md

Nette Modules on the Steroids Build Status

Simple registration and management of Nette modules & extensions., (*1)

Read more on project homepage., (*2)

Features

Simple configuration

config.neon

In config.neon register extension Flame\Modules\DI\ModulesExtension, (*3)

extensions:
    - Flame\Modules\DI\ModulesExtension

Add your extensions

Register extensions very simply, (*4)

extensions:
    - App\AppModule\DI\AppExtension
    rest: Flame\Rest\DI\RestExtension
    events: Kdyby\Events\DI\EventsExtension
    # ...
    - Flame\Modules\DI\ModulesExtension # Do not forget to add it!

That's all, nothing more! Simple!, (*5)

TIP! Make sure the ModulesExtension is registered as the last nette extensions. You will avoid a lot of misunderstanding., (*6)

Examples

IRouterProvider

class AppExtension extends CompilerExtension implements Flame\Modules\Providers\IRouterProvider
{

    /**
     * Returns array of ServiceDefinition,
     * that will be appended to setup of router service
     * 
     * @example https://github.com/nette/sandbox/blob/master/app/router/RouterFactory.php - createRouter()
     * @return \Nette\Application\IRouter
     */
    public function getRoutesDefinition()
    {
        return new Nette\Application\Routers\Route('<module>/<presenter>/<action>[/<id>]', array(
            'module' => 'App',
            'Presenter' => 'Homepage',
            'action' => 'default',
            'id' => null
        );
    }
}

NEW!

You can add your separated service as your router factory, (*7)

class AppExtension extends CompilerExtension
{
    public function loadConfiguration()
        {
            $builder = $this->getContainerBuilder();
            $builder->addDefinition('service.routerFactory')
                ->setClass('Modules\RouterFactory') // YOUR ROUTER FACTORY CLASS
                ->addTag(Flame\Modules\ModulesExtension::TAG_ROUTER); // DONT FORGET TO ADD THE TAG!
        }
}

IPresenterMappingProvider

class AppExtension extends CompilerExtension implements Flame\Modules\Providers\IPresenterMappingProvider
{

    /**
         * Returns array of ClassNameMask => PresenterNameMask
         *
         * @example return array('*' => 'Booking\*Module\Presenters\*Presenter');
         * @return array
         */
        public function getPresenterMapping()
        {
            return array(
                '*' => 'App\*Module\Presenters\*Presenter'
            );
        }
}

IParametersProvider

class AppExtension extends CompilerExtension implements Flame\Modules\Providers\IParametersProvider
{

    /**
     * Return array of parameters,
     * which you want to add into DIC
     *
     * @example return array('images' => 'path/to/folder/with/images');
     * @return array
     */
    public function getParameters()
    {
        return array(
            'images' => '%wwwDir%/path/to/folder/with/images',
            'consoleMode' => true,
            'appDir' => 'aa'
        );
    }

}

ITemplateHelpersProvider

class HelperExtension extends CompilerExtension implements Flame\Modules\Providers\ITemplateHelpersProvider
{

    /**
     * Return list of helpers definitions or providers
     *
     * @return array
     */
    public function getHelpersConfiguration()
    {
        return array(
            'App\HelperModule\Template\HelperProvider'
        );
    }
}

ILatteMacrosProvider


class MacroExtension extends CompilerExtension implements Flame\Modules\Providers\ILatteMacrosProvider { /** * Get array of latte macros classes * * @return array */ public function getLatteMacros() { return array( 'App\MacroModule\Template\MacroInstaller' ); } }

IErrorPresenterProvider

class ErrorExtension extends CompilerExtension implements Flame\Modules\Providers\IErrorPresenterProvider
{

    /**
     * Return name of error presenter
     *
     * @return string
     */
    public function getErrorPresenterName()
    {
        return 'Error:CustomError';
    }
}

and more: ITracyBarPanelsProvider, ITracyPanelsProvider, (*8)

What next?

Look into the project homepage for more details., (*9)

Read more about this package on blog [CZE]., (*10)

Based on SOLID MODULAR CONCEPT., (*11)

The Versions

13/03 2016

dev-master

9999999-dev https://github.com/flame-org/Modules

Nette modules on the Steroids

  Sources   Download

LGPL-3.0

The Requires

 

The Development Requires

framework simple modules nette tools flame jsifalda

24/09 2014

v2.3.0

2.3.0.0 https://github.com/flame-org/Modules

Nette modules on the Steroids

  Sources   Download

LGPL-3.0

The Requires

 

The Development Requires

framework simple modules nette tools flame jsifalda

03/09 2014

v2.2.0

2.2.0.0 https://github.com/flame-org/Modules

Nette modules on the Steroids

  Sources   Download

LGPL-3.0

The Requires

 

The Development Requires

framework simple modules nette tools flame jsifalda

29/06 2014

v2.1.0

2.1.0.0 https://github.com/flame-org/Modules

Nette modules on the Steroids

  Sources   Download

LGPL-3.0

The Requires

 

The Development Requires

framework simple modules nette tools flame jsifalda

07/06 2014

dev-macros

dev-macros https://github.com/flame-org/Modules

Nette modules on the Steroids

  Sources   Download

LGPL-3.0

The Requires

 

The Development Requires

framework simple modules nette tools flame jsifalda

17/05 2014

v2.0.0

2.0.0.0 https://github.com/flame-org/Modules

Nette modules on the Steroids

  Sources   Download

The Requires

 

The Development Requires

framework simple modules nette tools flame jsifalda

16/02 2014

v1.0.0

1.0.0.0 https://github.com/flame-org/Modules

Nette modules on the Steroids

  Sources   Download

The Requires

 

The Development Requires

framework simple modules nette tools flame jsifalda

10/12 2013

v0.7.0

0.7.0.0 https://github.com/flame-org/Modules

Nette modules on the Steroids

  Sources   Download

The Requires

 

The Development Requires

framework simple modules nette tools flame jsifalda

10/09 2013

v0.6.3

0.6.3.0 https://github.com/flame-org/Modules

Nette modules on the Steroids

  Sources   Download

The Requires

 

The Development Requires

framework simple modules nette tools flame jsifalda

24/08 2013

v0.6.0

0.6.0.0 https://github.com/flame-org/Modules

Nette modules on the Steroids

  Sources   Download

The Requires

 

The Development Requires

framework simple modules nette tools flame jsifalda

20/08 2013

v0.5.0

0.5.0.0 https://github.com/flame-org/Modules

Nette modules on the Steroids

  Sources   Download

The Requires

 

The Development Requires

framework simple modules nette tools flame jsifalda

26/07 2013

v0.2.0

0.2.0.0 https://github.com/flame-org/Modules

Nette modules on the Steroids

  Sources   Download

The Requires

 

The Development Requires

framework simple modules nette tools flame jsifalda

18/07 2013

v0.1.0

0.1.0.0 https://github.com/flame-org/Modules

Nette modules on the Steroids

  Sources   Download

The Requires

 

The Development Requires

framework simple modules nette tools flame jsifalda