pennyphp / penny

:moneybag: Php Framework made of other components
http://penny.gianarb.it/
Other
40 stars 7 forks source link

package/module support? #80

Open samsonasik opened 8 years ago

samsonasik commented 8 years ago

I think it would be great to have package/module support so we can have plug and play another package/module that penny-based into our penny-app ?

samsonasik commented 8 years ago

and may be we can call "module" or "package" as "coin" ?

gianarb commented 8 years ago

ahah coin sounds good :D :D But I don't know if it's needed.. You can load all by dependency injection..

PS. I don't understand why Symfony use Bundles and ZF modules.. :cactus: For example with penny I use factories in DoctrineORMModule to create my entityManager :P

samsonasik commented 8 years ago

Yup, I think it's needed. For example, I have a coin with facilitate Command or generate something via controller. So, I just register the coin, and it works, no need copy config/files at all.

Warm regards,

Abdul Malik Ikhsan

Pada 2 Okt 2015, pukul 16.17, Gianluca Arbezzano notifications@github.com menulis:

ahah coin sounds good :D :D But I don't know if it's needed.. You can load all by dependency injection..

PS. I don't understand why Symfony use Bundles and ZF modules.. For example with penny I use factories in DoctrineORMModule to create my entityManager :P

— Reply to this email directly or view it on GitHub.

samsonasik commented 8 years ago

For example, I have coin named "SanAuthCoin" that will do auth tasks:

SanAuthCoin
    config  
       di.php
       auth.local.php.dist
    src 
      Controller
         AuthController.php
      coin.php
use GianArb\Penny\App;

$app = new App();

$app->getContainer()->get('event_manager')
                    ->attach('auth.hook', function ($e) {
    // do something...
}, 100);

So, $app->run(); will scan if there is coin(s) registered in "coin" config, and run index.php per-coin.

gianarb commented 8 years ago

I should be very happy to support this feature but in my opinion must not mount it default..

My idea is "Perfect but I'm not interested to start my app with this feature". We can try to write an easy coin-loader to load external package.. :) Maybe the same idea of Zend\ModuleManager but more easy.. (maybe we can try to see it).. And tomorrow you will use Penny\CoinLoader in zend-expressive :dancer:

samsonasik commented 8 years ago

Yes, it would load "coins" if the "coins" config is not empty. So, in config/di.php or config/coin.php, if no coint registered, they will not be loaded.

Warm regards,

Abdul Malik Ikhsan

Pada 2 Okt 2015, pukul 17.29, Gianluca Arbezzano notifications@github.com menulis:

I should be very happy to support this feature but in my opinion must not mount it default..

My idea is "Perfect but I'm not interested to start my app with this feature". We can try to write an easy coin-loader to load external package.. :) Maybe the same idea of Zend\ModuleManager but more easy.. (maybe we can try to see it).. And tomorrow you will use Penny\CoinLoader in zend-expressive

— Reply to this email directly or view it on GitHub.

fntlnz commented 8 years ago

I really like this idea. This would help in creating more "application level" redistributable layers and in creating a micro service oriented architecture.

gianarb commented 8 years ago

@fntlnz perfect! :) I will add @samsonasik into the penny org to help us during this work.. :)

Idea for the name? My idea is an agnostic layer.. I'm not interested to build a component for penny but... name??

Feedback! :)

samsonasik commented 8 years ago

Thanks. Usually, a package-framework named by developers with package suffix, for ex: AlbumCoin, BlogCoin, etc. PocketCoin or Coinloader seems too long for me. I'm for Coin or Pocket, but prefer Coin as it seems smaller than penny, Pocket seems can be a place of collections of coins list, that maybe we can create a FriendOfPenny org for that ;)

Warm regards,

Abdul Malik Ikhsan

Pada 3 Okt 2015, pukul 06.20, Gianluca Arbezzano notifications@github.com menulis:

@fntlnz perfect! :) I will add @samsonasik into the penny org to help us during this work.. :)

Idea for the name? My idea is an agnostic layer.. I'm not interested to build a component for penny but... name??

CoinLoader PocketCoin ??? Feedback! :)

— Reply to this email directly or view it on GitHub.

fntlnz commented 8 years ago

Coin sounds perfect to me. Pocket could also be the name of the class that load coins. On Oct 3, 2015 05:30, "Abdul Malik Ikhsan" notifications@github.com wrote:

Thanks. Usually, a package-framework named by developers with package suffix, for ex: AlbumCoin, BlogCoin, etc. PocketCoin or Coinloader seems too long for me. I'm for Coin or Pocket, but prefer Coin as it seems smaller than penny, Pocket seems can be a place of collections of coins list, that maybe we can create a FriendOfPenny org for that ;)

Warm regards,

Abdul Malik Ikhsan

Pada 3 Okt 2015, pukul 06.20, Gianluca Arbezzano notifications@github.com menulis:

@fntlnz perfect! :) I will add @samsonasik into the penny org to help us during this work.. :)

Idea for the name? My idea is an agnostic layer.. I'm not interested to build a component for penny but... name??

CoinLoader PocketCoin ??? Feedback! :)

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/pennyphp/penny/issues/80#issuecomment-145197665.

gianarb commented 8 years ago

Hello Guys.. I'm studying this project https://github.com/zendframework/zend-modulemanager

It seems very simple.. We cannot try to use it to load module in penny? :+1:

samsonasik commented 8 years ago

hm..., so Penny module/coin will has Module.php ?

EmanueleMinotto commented 8 years ago

This could be a really bad idea to me becase penny "is focused around the interoperability concept".

To be honest I don't like the sf's *Bundle.php nor the zf's Module.php file ^^' because they doesn't seem to be built on a known solution, RFC, standard or something like these.

Imo something around the things I'm listing below should be implemented without considering already existing solutions.

fntlnz commented 8 years ago

What we decided there? I thought about this for a few days and I think we need a way to allow the development of modular applications but I'm not okay with the fact of using the Symfony or ZF or framework X approach. I don't even think we need to reinvent the wheel so for me puli could be a good starting point since the fact that it offers itself as a standard and interoperable solution to solve this problem.

gianarb commented 8 years ago

I don't know Puli :) but I agree with

I don't even think we need to reinvent the wheel @fntlnz

@EmanueleMinotto I see that you follow Puli at the moment.. Are you interesting to propose an implementation for penny? (np if you are not interested)..

@samsonasik another "LoadManager" IMO is a bad idea and I'm not interesting to follow this component :) But few days ago I wrote it on Skype for another topic.. If you have time ping me.. :D :D

samsonasik commented 8 years ago

I am online in skype now ;)

EmanueleMinotto commented 8 years ago

@gianarb I'll do :+1:

samsonasik commented 8 years ago

We can have another option by creating package like the following:

AwesomePenny
      config
            awesome.local.php.dist
      src
         Controller
             AwesomeController.php
     view
       awesome.php

And we manage autoloader with composer. The problem is on the view side, we define in penny-classic-app:

    'template' => \DI\object(\League\Plates\Engine::class)->constructor('./app/view/'),

we should not force user to copy more then one config/file/folder just to make the package/module works, @EmanueleMinotto so probably puli can make view inside 'AwesomePenny` package part of './app/view' ?

EmanueleMinotto commented 8 years ago

@samsonasik sorry, I've just seen the question yes, using puli you could do custom mapping, anyway I'm not an expert of puli yet ^^' so to have a confirmation you can ask in the Gitter channel