Re: How to port PHP projects which require composer
Date: Fri, 13 Jan 2023 16:25:58 UTC
On Fri, Jan 13, 2023, at 10:12 AM, thierry@freebsd.org wrote: > Selon Dan Langille <dan@langille.org> le ven. 13 janv. 11:20:25 2023 : > >> Hello, >> >> I'm looking at porting https://github.com/vstelmakh/url-highlight >> for use by FreshPorts. >> >> My current solution: >> >> % sudo pkg install php81-composer >> % fetch -o url-highlight-v3.0.1.tar.gz >> https://github.com/vstelmakh/url-highlight/archive/refs/tags/v3.0.1.tar.gz >> % tar -xzf url-highlight-v3.0.1.tar.gz >> % composer require vstelmakh/url-highlight >> >> At this point, everything I need is in the newly-created vendor directory. >> >> If I copy that vendor directory to /usr/local/www/freshports/, I can >> use it like this: >> >> <?php >> >> require_once($_SERVER['DOCUMENT_ROOT'] . '/../vendor/autoload.php'); >> use VStelmakh\UrlHighlight\Encoder\HtmlSpecialcharsEncoder; >> use VStelmakh\UrlHighlight\UrlHighlight; >> >> ... etc >> >> >> What is the proper way to port code like this? > > It would be very interesting to have a Mk/Uses/composer.mk, like we > have Mk/Uses/pear.mk. > > Adding cyberbotx@cyberbotx.com to the list: do you think it is possible? FYI, what I do with net-mgmt/librenms[1] is manually build the vendor directory and upload it as a separate DISTFILE. It works, but it is a manual process[2]. 1 - https://cgit.freebsd.org/ports/tree/net-mgmt/librenms/Makefile#n6 2 - https://gist.github.com/dlangille/e91b77ca4a32dfcbcdd7515ffb263e74 -- Dan Langille dan@langille.org