Survey: to composer or not to composer

classic Classic list List threaded Threaded
25 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Survey: to composer or not to composer

Marco Pivetta
Hi everybody!

tl;dr: ZF2: do you use composer or Zend\Loader? Simply reply with "loader" or "composer" :)

I've been discussing on IRC about dropping the pre-configured Zend\Loader instance in standard MVC applications (we're discussing that for ZF3).
Since I was asserting that most users do use composer for autoloading their stuff, I got told to get proof of that - so please just drop me a line :)

The main idea is to move away from configuring autoloading per-library and instead use composer to autoload everything. Here's how the config of a composer.json file would look:

{
    "autoload": {
        "psr-0": {
            "MyLib": "path/to/my-lib"
        }
    }
}

Here's how it would look with Zend\Loader:

include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
Zend\Loader\AutoloaderFactory::factory(array(
    'Zend\Loader\StandardAutoloader' => array(
        'autoregister_zf' => true,
        'namespaces' => array(
            'MyLib' => "path/to/my-lib",
        ),
    )
));

The main difference here is that composer requires us to run `composer dump-autoload` before being able to use `MyLib`

The idea is NOT about dropping Zend\Loader, but just removing the initialization logic from the skeleton application.

If you also have thoughts except for your preference, please share!


Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

Xerkus
loader+composer
zend loader for modules under development and modules not managed by
composer.

On 31.05.2013 4:13, Marco Pivetta wrote:

> Hi everybody!
>
> tl;dr: ZF2: do you use composer or Zend\Loader? Simply reply with
> "loader" or "composer" :)
>
> I've been discussing on IRC about dropping the pre-configured
> Zend\Loader instance in standard MVC applications (we're discussing
> that for ZF3).
> Since I was asserting that most users do use composer for autoloading
> their stuff, I got told to get proof of that - so please just drop me
> a line :)
>
> The main idea is to move away from configuring autoloading per-library
> and instead use composer to autoload everything. Here's how the config
> of a composer.json file would look:
>
> {
>     "autoload": {
>         "psr-0": {
>             "MyLib": "path/to/my-lib"
>         }
>     }
> }
>
> Here's how it would look with Zend\Loader:
>
> include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
> Zend\Loader\AutoloaderFactory::factory(array(
>     'Zend\Loader\StandardAutoloader' => array(
>         'autoregister_zf' => true,
>         'namespaces' => array(
>             'MyLib' => "path/to/my-lib",
>         ),
>     )
> ));
>
> The main difference here is that composer requires us to run `composer
> dump-autoload` before being able to use `MyLib`
>
> The idea is NOT about dropping Zend\Loader, but just removing the
> initialization logic from the skeleton application.
>
> If you also have thoughts except for your preference, please share!
>
>
>
> Marco Pivetta
>
> http://twitter.com/Ocramius
>
> http://ocramius.github.com/


--
Aleksey Khudyakov
Web developer, ZCE

Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

Pádraic Brady
In reply to this post by Marco Pivetta
I use both.

Also, why on God's green earth would we pin all our future's on
Composer? It's nice to have, once you secure the workflow (it suffers
from SSL verification vulnerabilities), but shouldn't be a necessary
dependency. Next, someone will tell me that libraries should all be
either Modules or Bundles and I'll explode into rant mode over keeping
reusable functional units independent of optional overarching
certain-to-be-redundant-one-day architectures ;).

Paddy

On 30 May 2013 18:13, Marco Pivetta <[hidden email]> wrote:

> Hi everybody!
>
> tl;dr: ZF2: do you use composer or Zend\Loader? Simply reply with "loader"
> or "composer" :)
>
> I've been discussing on IRC about dropping the pre-configured Zend\Loader
> instance in standard MVC applications (we're discussing that for ZF3).
> Since I was asserting that most users do use composer for autoloading their
> stuff, I got told to get proof of that - so please just drop me a line :)
>
> The main idea is to move away from configuring autoloading per-library and
> instead use composer to autoload everything. Here's how the config of a
> composer.json file would look:
>
> {
>     "autoload": {
>         "psr-0": {
>             "MyLib": "path/to/my-lib"
>         }
>     }
> }
>
> Here's how it would look with Zend\Loader:
>
> include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
> Zend\Loader\AutoloaderFactory::factory(array(
>     'Zend\Loader\StandardAutoloader' => array(
>         'autoregister_zf' => true,
>         'namespaces' => array(
>             'MyLib' => "path/to/my-lib",
>         ),
>     )
> ));
>
> The main difference here is that composer requires us to run `composer
> dump-autoload` before being able to use `MyLib`
>
> The idea is NOT about dropping Zend\Loader, but just removing the
> initialization logic from the skeleton application.
>
> If you also have thoughts except for your preference, please share!
>
>
>
> Marco Pivetta
>
> http://twitter.com/Ocramius
>
> http://ocramius.github.com/



--

--
Pádraic Brady

http://blog.astrumfutura.com
http://www.survivethedeepend.com
Zend Framework Community Review Team
Zend Framework PHP-FIG Representative
Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

mtymek
This post has NOT been accepted by the mailing list yet.
In reply to this post by Marco Pivetta
composer
Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

Marco Pivetta
In reply to this post by Pádraic Brady
@Padraic that doesn't mean you cannot manually instantiate Zend\Loader in your index.php (example). Also, we're not discussing composer's package management side - see the configuration in the first post

Otherwise, I agree - composer is still affected by MITM.



On 30 May 2013 19:33, Pádraic Brady <[hidden email]> wrote:
I use both.

Also, why on God's green earth would we pin all our future's on
Composer? It's nice to have, once you secure the workflow (it suffers
from SSL verification vulnerabilities), but shouldn't be a necessary
dependency. Next, someone will tell me that libraries should all be
either Modules or Bundles and I'll explode into rant mode over keeping
reusable functional units independent of optional overarching
certain-to-be-redundant-one-day architectures ;).

Paddy

On 30 May 2013 18:13, Marco Pivetta <[hidden email]> wrote:
> Hi everybody!
>
> tl;dr: ZF2: do you use composer or Zend\Loader? Simply reply with "loader"
> or "composer" :)
>
> I've been discussing on IRC about dropping the pre-configured Zend\Loader
> instance in standard MVC applications (we're discussing that for ZF3).
> Since I was asserting that most users do use composer for autoloading their
> stuff, I got told to get proof of that - so please just drop me a line :)
>
> The main idea is to move away from configuring autoloading per-library and
> instead use composer to autoload everything. Here's how the config of a
> composer.json file would look:
>
> {
>     "autoload": {
>         "psr-0": {
>             "MyLib": "path/to/my-lib"
>         }
>     }
> }
>
> Here's how it would look with Zend\Loader:
>
> include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
> Zend\Loader\AutoloaderFactory::factory(array(
>     'Zend\Loader\StandardAutoloader' => array(
>         'autoregister_zf' => true,
>         'namespaces' => array(
>             'MyLib' => "path/to/my-lib",
>         ),
>     )
> ));
>
> The main difference here is that composer requires us to run `composer
> dump-autoload` before being able to use `MyLib`
>
> The idea is NOT about dropping Zend\Loader, but just removing the
> initialization logic from the skeleton application.
>
> If you also have thoughts except for your preference, please share!
>
>
>
> Marco Pivetta
>
> http://twitter.com/Ocramius
>
> http://ocramius.github.com/



--

--
Pádraic Brady

http://blog.astrumfutura.com
http://www.survivethedeepend.com
Zend Framework Community Review Team
Zend Framework PHP-FIG Representative

Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

usulix
This post has NOT been accepted by the mailing list yet.
In reply to this post by Marco Pivetta
composer
Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

weierophinney
Administrator
In reply to this post by Marco Pivetta
On Thu, May 30, 2013 at 12:13 PM, Marco Pivetta <[hidden email]> wrote:
> Hi everybody!
>
> tl;dr: ZF2: do you use composer or Zend\Loader? Simply reply with "loader"
> or "composer" :)

Both.

Modules inside my application that do not need to be re-used will use
Zend\Loader, while those that are installable via Composer will use
composer. That said, I don't like to limit installation options for
users of my modules, either; if they want to add them as git
submodules, or download them and deflate them into their application,
that's fine, too -- and that's where having Zend\Loader available as
an autoloading mechanism makes sense.

Composer simply... simplifies... usage.

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

Michael Gooden

On 30 May 2013 22:45, Matthew Weier O'Phinney <[hidden email]> wrote:
....
Composer simply... simplifies... usage.

I think this is the most important thing for me.

While the concept of libraries existed for Composer and ZF2, I usually ended up either writing my own code to do the same thing or using chopped up bits of libraries I found.

Composer has really improved the way I work, to such an extent that all new projects I am doing have so little code written by me I feel like I am scamming the client :p

I still use Zend\Loader for the internal application modules that will never touch another project. My ZF2 is loaded via composer.

Regards,

Michael Gooden
Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

Slamdunk
In reply to this post by Marco Pivetta
composer

I'm really impressed by how many people don't use composer for everything.
* Application specific module? Application's composer.json autoload key.
* Standalone module? Standalone repo with composer.json, "repositories"
key on Application's composer.json to point at filesystem or internal
DVCS server.

If a module is standalone, it needs a dedicated repo.
If such, it likely needs a composer.json to run tests.
If such, "repositories" key on Application's composer.json is far way
easier, robust and flexible than worry about autoloading in the Module.php.

Am I the only one using this procedure?

Filippo

Il 30/05/2013 19:13, Marco Pivetta ha scritto:

> Hi everybody!
>
> tl;dr: ZF2: do you use composer or Zend\Loader? Simply reply with
> "loader" or "composer" :)
>
>
>
> Marco Pivetta
>
> http://twitter.com/Ocramius
>
> http://ocramius.github.com/
Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

Tirth Bodawala
Composer
Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

Oscar Fanelli
In reply to this post by Marco Pivetta
composer

---

Oscar Fanelli
Gamempire.it - Creatore e Direttore esecutivo
Tom's Hardware Italia - Sviluppatore

Email secondaria: [hidden email]
Skype: gamempire
Tel: 3388696167

Il giorno 30/mag/2013, alle ore 19:13, Marco Pivetta <[hidden email]> ha scritto:

Hi everybody!

tl;dr: ZF2: do you use composer or Zend\Loader? Simply reply with "loader" or "composer" :)

I've been discussing on IRC about dropping the pre-configured Zend\Loader instance in standard MVC applications (we're discussing that for ZF3).
Since I was asserting that most users do use composer for autoloading their stuff, I got told to get proof of that - so please just drop me a line :)

The main idea is to move away from configuring autoloading per-library and instead use composer to autoload everything. Here's how the config of a composer.json file would look:

{
    "autoload": {
        "psr-0": {
            "MyLib": "path/to/my-lib"
        }
    }
}

Here's how it would look with Zend\Loader:

include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
Zend\Loader\AutoloaderFactory::factory(array(
    'Zend\Loader\StandardAutoloader' => array(
        'autoregister_zf' => true,
        'namespaces' => array(
            'MyLib' => "path/to/my-lib",
        ),
    )
));

The main difference here is that composer requires us to run `composer dump-autoload` before being able to use `MyLib`

The idea is NOT about dropping Zend\Loader, but just removing the initialization logic from the skeleton application.

If you also have thoughts except for your preference, please share!



Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

David Muir-2
In reply to this post by Marco Pivetta
both although using composer more and more

David

On 31/05/2013, at 3:13 AM, Marco Pivetta <[hidden email]> wrote:

Hi everybody!

tl;dr: ZF2: do you use composer or Zend\Loader? Simply reply with "loader" or "composer" :)

I've been discussing on IRC about dropping the pre-configured Zend\Loader instance in standard MVC applications (we're discussing that for ZF3).
Since I was asserting that most users do use composer for autoloading their stuff, I got told to get proof of that - so please just drop me a line :)

The main idea is to move away from configuring autoloading per-library and instead use composer to autoload everything. Here's how the config of a composer.json file would look:

{
    "autoload": {
        "psr-0": {
            "MyLib": "path/to/my-lib"
        }
    }
}

Here's how it would look with Zend\Loader:

include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
Zend\Loader\AutoloaderFactory::factory(array(
    'Zend\Loader\StandardAutoloader' => array(
        'autoregister_zf' => true,
        'namespaces' => array(
            'MyLib' => "path/to/my-lib",
        ),
    )
));

The main difference here is that composer requires us to run `composer dump-autoload` before being able to use `MyLib`

The idea is NOT about dropping Zend\Loader, but just removing the initialization logic from the skeleton application.

If you also have thoughts except for your preference, please share!



Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

ThaDafinser

Composer.

Am 31.05.2013 15:30 schrieb "David Muir" <[hidden email]>:
both although using composer more and more

David

On 31/05/2013, at 3:13 AM, Marco Pivetta <[hidden email]> wrote:

Hi everybody!

tl;dr: ZF2: do you use composer or Zend\Loader? Simply reply with "loader" or "composer" :)

I've been discussing on IRC about dropping the pre-configured Zend\Loader instance in standard MVC applications (we're discussing that for ZF3).
Since I was asserting that most users do use composer for autoloading their stuff, I got told to get proof of that - so please just drop me a line :)

The main idea is to move away from configuring autoloading per-library and instead use composer to autoload everything. Here's how the config of a composer.json file would look:

{
    "autoload": {
        "psr-0": {
            "MyLib": "path/to/my-lib"
        }
    }
}

Here's how it would look with Zend\Loader:

include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
Zend\Loader\AutoloaderFactory::factory(array(
    'Zend\Loader\StandardAutoloader' => array(
        'autoregister_zf' => true,
        'namespaces' => array(
            'MyLib' => "path/to/my-lib",
        ),
    )
));

The main difference here is that composer requires us to run `composer dump-autoload` before being able to use `MyLib`

The idea is NOT about dropping Zend\Loader, but just removing the initialization logic from the skeleton application.

If you also have thoughts except for your preference, please share!



Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

jeremiah
In reply to this post by Marco Pivetta
On May 30, 2013, at 10:13 AM, Marco Pivetta wrote:

tl;dr: ZF2: do you use composer or Zend\Loader? Simply reply with "loader" or "composer" :)

composer
Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

jeremiah
On Jun 1, 2013, at 4:32 PM, Jeremiah Small wrote:

composer

I'm sorry, I have to change my response to both.

For modules which get built in the same project, and will never be shared, we still use the standard skeleton setup of getAutoloaderConfig() in the Module.php, which simply configures Zend\Loader using __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__

That's pretty convenient, and I think it's important to have that in the skeleton app.
Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

jeremiah
In reply to this post by Marco Pivetta
On May 30, 2013, at 10:13 AM, Marco Pivetta wrote:

The idea is NOT about dropping Zend\Loader, but just removing the initialization logic from the skeleton application

Do you mean removing the initialization logic inside init_autoloader.php if it can't include 'vendor/autoload.php'?

Jeremiah
Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

Marco Pivetta

On 2 June 2013 02:04, Jeremiah Small <[hidden email]> wrote:
On May 30, 2013, at 10:13 AM, Marco Pivetta wrote:

The idea is NOT about dropping Zend\Loader, but just removing the initialization logic from the skeleton application

Do you mean removing the initialization logic inside init_autoloader.php if it can't include 'vendor/autoload.php'?


That's exactly what spawned this survey - nothing more than that



Marco Pivetta

http://twitter.com/Ocramius     

http://ocramius.github.com/
Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

Gabriel403
This post has NOT been accepted by the mailing list yet.
Whatever is done in the zsa atm, composer by default I think


On 2 June 2013 02:18, Marco Pivetta [via Zend Framework Community] <[hidden email]> wrote:

On 2 June 2013 02:04, Jeremiah Small <[hidden email]> wrote:
On May 30, 2013, at 10:13 AM, Marco Pivetta wrote:

The idea is NOT about dropping Zend\Loader, but just removing the initialization logic from the skeleton application

Do you mean removing the initialization logic inside init_autoloader.php if it can't include 'vendor/autoload.php'?


That's exactly what spawned this survey - nothing more than that



If you reply to this email, your message will be added to the discussion below:
http://zend-framework-community.634137.n4.nabble.com/Survey-to-composer-or-not-to-composer-tp4660141p4660203.html
To start a new topic under ZF Contributor, email [hidden email]
To unsubscribe from ZF Contributor, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

Daniel
In reply to this post by Marco Pivetta
Composer

Em 30-05-2013 14:13, Marco Pivetta escreveu:
Hi everybody!

tl;dr: ZF2: do you use composer or Zend\Loader? Simply reply with "loader" or "composer" :)

I've been discussing on IRC about dropping the pre-configured Zend\Loader instance in standard MVC applications (we're discussing that for ZF3).
Since I was asserting that most users do use composer for autoloading their stuff, I got told to get proof of that - so please just drop me a line :)

The main idea is to move away from configuring autoloading per-library and instead use composer to autoload everything. Here's how the config of a composer.json file would look:

{
    "autoload": {
        "psr-0": {
            "MyLib": "path/to/my-lib"
        }
    }
}

Here's how it would look with Zend\Loader:

include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
Zend\Loader\AutoloaderFactory::factory(array(
    'Zend\Loader\StandardAutoloader' => array(
        'autoregister_zf' => true,
        'namespaces' => array(
            'MyLib' => "path/to/my-lib",
        ),
    )
));

The main difference here is that composer requires us to run `composer dump-autoload` before being able to use `MyLib`

The idea is NOT about dropping Zend\Loader, but just removing the initialization logic from the skeleton application.

If you also have thoughts except for your preference, please share!




Reply | Threaded
Open this post in threaded view
|

Re: Survey: to composer or not to composer

booradleys
This post has NOT been accepted by the mailing list yet.
I'm using composer ;-)

2013/6/2 Daniel [via Zend Framework Community] <[hidden email]>
Composer

Em 30-05-2013 14:13, Marco Pivetta escreveu:
Hi everybody!

tl;dr: ZF2: do you use composer or Zend\Loader? Simply reply with "loader" or "composer" :)

I've been discussing on IRC about dropping the pre-configured Zend\Loader instance in standard MVC applications (we're discussing that for ZF3).
Since I was asserting that most users do use composer for autoloading their stuff, I got told to get proof of that - so please just drop me a line :)

The main idea is to move away from configuring autoloading per-library and instead use composer to autoload everything. Here's how the config of a composer.json file would look:

{
    "autoload": {
        "psr-0": {
            "MyLib": "path/to/my-lib"
        }
    }
}

Here's how it would look with Zend\Loader:

include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
Zend\Loader\AutoloaderFactory::factory(array(
    'Zend\Loader\StandardAutoloader' => array(
        'autoregister_zf' => true,
        'namespaces' => array(
            'MyLib' => "path/to/my-lib",
        ),
    )
));

The main difference here is that composer requires us to run `composer dump-autoload` before being able to use `MyLib`

The idea is NOT about dropping Zend\Loader, but just removing the initialization logic from the skeleton application.

If you also have thoughts except for your preference, please share!







If you reply to this email, your message will be added to the discussion below:
http://zend-framework-community.634137.n4.nabble.com/Survey-to-composer-or-not-to-composer-tp4660141p4660213.html
To start a new topic under ZF Contributor, email [hidden email]
To unsubscribe from ZF Contributor, click here.
NAML



--
David Quintard
Développeur Zend Framework
Portable : 06.82.56.05.00
Fixe: 02.54.72.15.48
Email: [hidden email]
12