question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Composer docs/bugs (clarification)

See original GitHub issue

(I’m using buildpack 4.3.77)

I’m trying to overcome a couple challenges deploying a PHP application to a CF PaaS (PWS).

I find your use of composer and related docs a little confusing:

By default, the PHP buildpack uses the composer.json and composer.lock files that reside inside the root directory, or in the directory specified as WEBDIR in your options.json. If you have composer files inside your app, but not in the default directories, use a COMPOSER_PATH environment variable for your app to specify this custom location, relative to the app root directory. Note that the composer.json and composer.lock files must be in the same directory.

COMPOSER_PATH is not mentioned in the table before. It would be great to get more detail if this is a leftover from another time or e.g. if this a separate var to point the buildpack to, to store composer.json (and .lock).


Also, is there history available what this means: “if you have composer files inside your app”.

I am confused by this statement, because — where else would they be? Composer keeps dependencies local to the application (usually). So this means, vendor/ should be within the application, not somewhere else.


What is the reason for default lib/vendor/ with this buildpack? Most code seems to expect vendor/? Most projects/frameworks follow a pattern where:

lib/ (sometimes called src/)
public/ (or web/ or www/)
vendor/

I realise there are (still) exceptions to this and people still put all their code in a “public” directory, but working around it like this, defeats the purpose of the buildpack to e.g. run a demo application.


I tried to use COMPOSER_INSTALL_OPTIONS:

{
    "COMPOSER_INSTALL_OPTIONS": "--no-interaction --no-progress",
    "COMPOSER_VENDOR_DIR": "vendor",
    "WEBDIR": "public"
}

This led to:

Invalid argument - - n o - i n t e r a c t i o n - - n o - p r o g r e s s. Use "composer require - - n o - i n t e r a c t i o n - - n o - p r o g r e s s" instead to add packages to your composer.json.

(Edit: I guess this should be a list.)


Maybe not in scope of this buildpack — is there a validator for everything in .bp-config/options.json)? E.g. pre-push, so I don’t have to dig around in the buildpack’s code to figure this out?


Happy to send a PR with doc fixes or discuss further.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
tillcommented, Jun 18, 2019

@dmikusa-pivotal So I “pack” my app, add to Dockerhub and then change my manifest to use the docker image? I’ll see if I can try that on the weekend.

2reactions
tillcommented, Jun 14, 2019

Long story short, the buildpack isn’t trying to force one way or another, just be flexible to support the different ways people want to structure their projects.

The Buildpack does the opposite right now though. It’s not turn-key, as it requires configuration for the majority of all PHP frameworks and demo applications. Best practice is not to rely on include_path anymore as composer encourages local dependencies (scoped within the app) and provides optimised autoloaders which…

  1. Take care of finding files (by using mostly absolute paths, unless you tell it not to)
  2. Provide optimisations for classloading with for OpCache (or formerly APC) and general disk I/O.

Examples (which expect $APPROOT/vendor):

Search for more on Github — they all have (/)vendor in .gitignore.

If you follow a pattern where you have scripts in a bin/ folder, then most of these don’t work out of the box, as they ../vendor/autoload.php. That’s why most Symfony examples for Cloud Foundry disable/customize post-install-cmd. Not because the scripts don’t work, but because their invocation is broken by default (and I just happen to spend more time on trying to figure it out).

It’s great that the bp allows flexibility (even if I don’t see any merit), but this is using the opposite of what you should be the standard by introducing this lib/vendor thing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dev@httpd.apache.org, November 2017 - Apache Mail Archives
I'm reading the mod_md docs, and want some clarification on the following. In the docs for directive ManagedDomain, we have: There are two...
Read more >
GKE: Ephemeral local storage exceeded whenever container ...
I have a cluster set up in Google Kubernetes Engine (GKE), with preemptible instances, TPU support, and 1 container per node.
Read more >
fomantic-ui/RELEASE-NOTES.md - UNPKG
231, - Changed bower and composer package names from Semantic to Fomantic **Thanks ... [See this explanation](http://oi66.tinypic.com/2zr2ckk.jpg).
Read more >
https://ftp.nluug.nl/OpenBSD/Changelogs/ChangeLog.56
... productivity/davical: Makefile textproc/tcpdf : Makefile www/awl : Makefile www/composer : Makefile ... WIN32 U xenocara/lib/mesa/docs/bugs.html U ...
Read more >
commits-list 2009-September Archive by Author
[banshee] Auto-completion for composer, conductor, grouping and copyright ... [gtkmm-documentation] Clarify that all skeleton files need editing Mon Sep 14 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found