Re: How to port a PHP application that uses Composer?

From: Peter Beckman <beckman_at_angryox.com>
Date: Tue, 17 May 2022 03:14:25 UTC
PHP is an interpreted language, Unless there are compiled portions, there
is no porting necessary.

You're just running 'php composer.phar install' yes?


How does the "application" run? Is it just a directory that is configured
as a root directory for a webserver?

If so, look at www/wordpress or databases/mantisbt.
https://www.freshports.org/www/wordpress/

Mantis BT includes all of their composer dependencies in their distro. 
Wordpress seems to include a lot of dependencies too.

Consider that it is something the installer needs to do, or build the
package as a deterministic set of packages already installed.

Beckman



On Mon, 16 May 2022, Mel Pilgrim wrote:

> Composer is a github-centric dependency management tool for PHP applications. 
> It works very well on its own, but I'm having trouble figuring out how to 
> integrate it with pkg building.
>
> The composer workflow is:
>
> 1. Clone the PHP application repo, which has a composer.json file
> 2. Download composer.phar and run `php composer.phar ...`
> 3. Composer examines composer.json and downloads dependencies from other 
> github repos
> 4. Composer creates an autoloader script that does all of the require calls 
> for the dependencies
>
> The problem is that download and autoloader script part.  If I ran it as part 
> of the pkg building process, there's a fetch-extract race as it needs network 
> access, but also a file extracted from the distfile.
>
> If I left it to user config, the autoloader script creation will change a 
> file managed by pkg.
>
> So how do I do this? Can a composer-using PHP application be ported?
>
>

---------------------------------------------------------------------------
Peter Beckman                                                  Internet Guy
beckman@angryox.com                                https://www.angryox.com/
---------------------------------------------------------------------------