Dependency Management: Composer

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The next feature release of phpBB 3 will be 3.2/Rhea followed by 3.3.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.1. If you need support for phpBB 3.1 please visit the 3.1.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
User avatar
igorw
Registered User
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

Dependency Management: Composer

Post by igorw » Sat Mar 31, 2012 4:28 pm

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 » Wed May 23, 2012 12:44 pm

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 » Wed May 23, 2012 4:36 pm

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 » Thu May 24, 2012 7:16 am

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: 211
Joined: Mon May 26, 2003 1:35 pm
Location: France

Re: Dependency Management: Composer

Post by -=ET=- » Mon Jul 09, 2012 12:36 am

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 » Mon Jul 09, 2012 12:55 pm

-=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: 211
Joined: Mon May 26, 2003 1:35 pm
Location: France

Re: Dependency Management: Composer

Post by -=ET=- » Mon Jul 09, 2012 2:19 pm

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: 126
Joined: Thu May 20, 2010 4:01 am
Location: Brazil
Contact:

Re: Dependency Management: Composer

Post by Vinny » Mon Jul 09, 2012 4:31 pm

-=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: 211
Joined: Mon May 26, 2003 1:35 pm
Location: France

Re: Dependency Management: Composer

Post by -=ET=- » Mon Jul 09, 2012 11:47 pm

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 » Fri Jul 20, 2012 4:53 pm

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