Auto-installable extensions

Now Myii project download extensions and with a config array install them with any manual operation. I’ve tryied with 3 my extensions:

scrolltop,

lyiightbox,

queryii,

it work!

Yii2.0 can improve this feature and standardization of extensions. So, we’ll can use phing or yiic to download and install extensions automatically. All three extensions are stored on github.

My extensions has this structure:

/EXTENSION_NAME.readme.markdown

/EXTENSION_NAME/config/main.php

/EXTENSION_NAME/* <- classes or folders …

this is config main:




<?php


return array(

    'version' => '1.0',

    'extract' => array(

        'to' => 'protected/extensions/'

    ),

);




What about dependencies?

Can you give me more details? Are you talking about dependencies from others extensions or from different version of frameworks?

Both.

There are a couple of approaches:

  • External dependencies (Linux, FreeBSD etc. way)

  • Self-contained dependencies (MacOS X way?)

Dependency hell VS Redundant code

In my opinion self-contained dependencies would be an interesting approach.

I spent some time a few months ago writing a package manager for Yii, but I didn’t finish it: https://github.com/phpnode/Yii-Package-Manager

I think that rather than reinventing the wheel, we should adopt Composer: https://github.com/composer/composer as it seems to be the most active, modern php package manager.

Otherwise a significant amount of dev time will be spend dedicated to maintaining and updating our own system. Decent package management is not a trivial problem to solve, we should concentrate on the framework instead.

I want support latest 1.1.x version and latest extension version. But should be possible to set all info in the extension config file. It can tell to Myii the version supported of yii and, eventually, for each extension, the version of dependencies. But … but is not an’issue now. If someone need this feature, I’ll implement it right now!

Anyway, I agree with phpnode. Composer looks OK and I think it will fit Yii2 well. sensorario, if you have some free time maybe you’ll be able to evaluate Composer and tell us your opinion about what’s missing and if it’s OK in its current state.

Yes!

Really awesome! :D

Well, at the moment I am working on Myii. I am trying to do a video to show you something like …

clone Myii (git clone git@github.com:sensorario/Myii)

move to Myii (cd Myii)

crate a new webapp (phing create)

load console (php yii/yiic shell projects/APP_NAME/protected/config/main.php)

create table products ( >>> queryii create product)

add a field "name" ( >>> queryii alter product add string name)

load gii (Myii load a /protected/views/layouts/main.php that automatically show Gii on main menu so you do not have to do anything by hand)

create model, crud, …

That’s it! few minutes. But I need to see composer. At the moment I have two kind of extensions:

console command (queryii)

widgets (lyiightbox and scrolltop)

This is widgets config file:




return array(

    'version' => '1.0',

    'extract' => array(

        'to' => 'protected/commands/shell'

    ),

);



And this is console command config file:




return array(

    'version' => '1.0',

    'extract' => array(

        'files' => array(

            'QueryiiCommand.php'

        ),

        'to' => 'protected/commands/shell'

    ),

);



Maybe composer can make more easy this steps … I am thinking that Myii can work well for yii1.1.x

Maybe composer can work very well for Yii2 I want to study it!