Dependency Management: Composer

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The current feature release of phpBB 3 is 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.3.x. If you need support for phpBB 3.3.x please visit the 3.3.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Post Reply
igorw
Registered User
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

Dependency Management: Composer

Post by igorw »

I'm happy announce that we are now using composer to manage the development dependencies of phpBB.

What's composer?

Composer is a dependency manager for PHP. It allows PHP projects to depend on other PHP projects, such as libraries. Composer manages and installs these dependencies.

What are phpBB's dependencies?

Composer was added as part of the EventDispatcher pull request (aka "Hooks System"). We are using the Symfony2 event dispatcher in phpBB now, and you should install it through composer. Right now that is the only dependency, but if we add any other ones, they will also use composer.

What does this mean for me?

This is only significant for people working on the phpBB core. They will need to run the composer install command to get the dependencies. We have added instructions for that to the README:
To be able to run an installation from the repo (and not from a pre-built package) you need to run the following commands to install phpBB's dependencies.

Code: Select all

cd phpBB
php ../composer.phar install

Michaelo
Registered User
Posts: 106
Joined: Thu Apr 01, 2004 7:56 am
Location: Dublin

Re: Dependency Management: Composer

Post by Michaelo »

As no default composer.json exists I built using...

Code: Select all

php composer.phra init
Added: symfony/event-dispatcher": "2.0.* as I don't see any reference to required dependencies...
I'm not even sure if this is required in order to install and test, don't remember it being required previously...
Then...

Code: Select all

php composer.phra install
Mods: Forum Icons Enhancement, Kiss Portal Engine
Links:
Kiss Portal Engine (dev site) Stargate Portal (archive site) ...
Styles: Technika

User avatar
bantu
3.0 Release Manager
3.0 Release Manager
Posts: 557
Joined: Thu Sep 07, 2006 11:22 am
Location: Karlsruhe, Germany
Contact:

Re: Dependency Management: Composer

Post by bantu »

Michaelo wrote:As no default composer.json exists [...]
It's right there.

Code: Select all

afischer@leonard:/var/www/projects/phpbb3/phpBB $ cat composer.json 
{
    "require": {
        "symfony/event-dispatcher": "2.0.*"
    }
}

Michaelo
Registered User
Posts: 106
Joined: Thu Apr 01, 2004 7:56 am
Location: Dublin

Re: Dependency Management: Composer

Post by Michaelo »

Somehow I managed to loose it but of course I see it now... apologies...
Not a wasted exercise, at least I know how to create it now... ;)
Mods: Forum Icons Enhancement, Kiss Portal Engine
Links:
Kiss Portal Engine (dev site) Stargate Portal (archive site) ...
Styles: Technika

User avatar
-=ET=-
Registered User
Posts: 214
Joined: Mon May 26, 2003 1:35 pm
Location: France

Re: Dependency Management: Composer

Post by -=ET=- »

igorw wrote:To be able to run an installation from the repo (and not from a pre-built package) you need to run the following commands to install phpBB's dependencies.

Code: Select all

cd phpBB
curl -s http://getcomposer.org/installer | php
php composer.phar install
Where do we need to run this? :?
Thanks!
Eternal newbie

User avatar
imkingdavid
Registered User
Posts: 1050
Joined: Thu Jul 30, 2009 12:06 pm

Re: Dependency Management: Composer

Post by imkingdavid »

-=ET=- wrote:
igorw wrote:To be able to run an installation from the repo (and not from a pre-built package) you need to run the following commands to install phpBB's dependencies.

Code: Select all

cd phpBB
curl -s http://getcomposer.org/installer | php
php composer.phar install
Where do we need to run this? :?
Thanks!
Depending on your OS, open cmd.exe or terminal or whatever console you use and copy/paste the commands in one by one. The first line is just to navigate to the phpBB directory within the phpbb3 repository. If you start console outside of the repository, you will need to provide a full path from your current location; the above code simply assumes you start console on the repository. You will need to have PHP properly set up on the PATH or else put the full path to it in place of "php".
I do custom MODs. PM for a quote!
View My: MODs | Portfolio
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.

User avatar
-=ET=-
Registered User
Posts: 214
Joined: Mon May 26, 2003 1:35 pm
Location: France

Re: Dependency Management: Composer

Post by -=ET=- »

imkingdavid wrote:Depending on your OS
XP
imkingdavid wrote:open cmd.exe
Yup
imkingdavid wrote:The first line is just to navigate to the phpBB directory within the phpbb3 repository. If you start console outside of the repository, you will need to provide a full path from your current location; the above code simply assumes you start console on the repository. You will need to have PHP properly set up on the PATH or else put the full path to it in place of "php".
Easy

I've added the php path to XP and went to the phpBB 3.1 dir.
But "curl -s http://getcomposer.org/installer | php" ends up with an error saying "curl" is an unknown command :|
Eternal newbie

User avatar
Vinny
Style Customisations
Style Customisations
Posts: 129
Joined: Thu May 20, 2010 4:01 am
Location: Brazil
Contact:

Re: Dependency Management: Composer

Post by Vinny »

-=ET=- wrote:I've added the php path to XP and went to the phpBB 3.1 dir.
But "curl -s http://getcomposer.org/installer | php" ends up with an error saying "curl" is an unknown command :|
Try this.

User avatar
-=ET=-
Registered User
Posts: 214
Joined: Mon May 26, 2003 1:35 pm
Location: France

Re: Dependency Management: Composer

Post by -=ET=- »

Vinny wrote:Try this.
Thanks! It works ;)
Eternal newbie

brandsrus
Registered User
Posts: 4
Joined: Sun Feb 25, 2007 6:48 pm

Re: Dependency Management: Composer

Post by brandsrus »

It is too difficult to install it in with Xampp on the Windows machine.

My directory is located on L:\xampp\htdocs\phpBB3.1 and with commandline in Windows is not possible to install symphony.

I don't understand how it works, so I can't test the new development version local.

Post Reply