heroku / heroku-buildpack-php
Toolkit for starting a PHP application locally, with or without foreman, using the same config for PHP and Apache2/Nginx as on Heroku
Installs: 1 059 652
Dependents: 17
Suggesters: 1
Security: 0
Stars: 808
Watchers: 123
Forks: 1
Open Issues: 38
Language:Shell
- dev-main
- v258
- v257
- v256
- v255
- v254
- v253
- v252
- v251
- v250
- v249
- v248
- v247
- v246
- v245
- v244
- v243
- v242
- v241
- v240
- v239
- v238
- v237
- v236
- v235
- v234
- v233
- v232
- v231
- v230
- v229
- v228
- v227
- v226
- v225
- v224
- v223
- v222
- v221
- v220
- v219
- v218
- v217
- v216
- v215
- v214
- v213
- v212
- v211
- v210
- v209
- v208
- v207
- v206
- v205
- v204
- v203
- v202
- v201
- v200
- v199
- v198
- v197
- v196
- v195
- v194
- v193
- v192
- v191
- v190
- v189
- v188
- v187
- v186
- v185
- v184
- v183
- v182
- v181
- v180
- v179
- v178
- v177
- v176
- v175
- v174
- v173
- v172
- v171
- v170
- v169
- v168
- v167
- v166
- v165
- v164
- v163
- v162
- v161
- v160
- v159
- v158
- v157
- v156
- v155
- v154
- v153
- v152
- v151
- v150
- v149
- v148
- v147
- v146
- v145
- v144
- v143
- v142
- v141
- v140
- v139
- v138
- v137
- v136
- v135
- v134
- v133
- v132
- v131
- v130
- v129
- v128
- v127
- v126
- v125
- v124
- v123
- v122
- v121
- v120
- v119
- v118
- v117
- v116
- v115
- v114
- v113
- v112
- v111
- v110
- v109
- v108
- v107
- v106
- v105
- v104
- v103
- v102
- v101
- v100
- v99
- v98
- v97
- v96
- v95
- v94
- v93
- v92
- v91
- v90
- v89
- v88
- v87
- v86
- v85
- v84
- v83
- v82
- v81
- v80
- v78
- v76
- v75
- v74
- v72
- v71
- v70
- v69
- v68
- v67
- v66
- v65
- v64
- v63
- v62
- v61
- v60
- v59
- v58
- v57
- v56
- v55
- v54
- v53
- v52
- v51
- v50
- v49
- v48
- v47
- v46
- v45
- v44
- v43
- v42
- v41
- v40
- v39
- v37
- v36
- v35
- v34
- v33
- v32
- v31
- v30
- v29
- v28
- v27
- v26
- v25
- v24
- v23
- v22
- v21
- v20
- v19
- v18
- v17
- v16
- v15
- v14
- v13
- v12
- dev-php-release-cycle-updates-2024
- dev-cnb-installer
- dev-develop
- dev-cgroupsv2
- dev-web-concurrency-set-by
- dev-bootimprove
- dev-gracefulstop
- dev-nginx
- dev-relpath
- dev-ci
- dev-composer-env-var
This package is auto-updated.
Last update: 2024-11-13 16:58:07 UTC
README
This is the official Heroku buildpack for PHP applications.
It uses Composer for dependency management, supports all recent versions of PHP as runtimes, and offers a choice of Apache2 or Nginx web servers.
Usage
You'll need to use at least an empty composer.json
in your application.
$ echo '{}' > composer.json
$ git add composer.json
$ git commit -m "add composer.json for PHP app detection"
If you also have files from other frameworks or languages that could trigger another buildpack to detect your application as one of its own, e.g. a package.json
which might cause your code to be detected as a Node.js application even if it is a PHP application, then you need to manually set your application to use this buildpack:
$ heroku buildpacks:set heroku/php
This will use the officially published version. To use the default branch from GitHub instead:
$ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-php
Please refer to Dev Center for further usage instructions.
Custom Platform Repositories
The buildpack uses Composer repositories to resolve platform (php
, ext-something
, ...) dependencies.
To use a custom Composer repository with additional or different platform packages, add the URL to its packages.json
to the HEROKU_PHP_PLATFORM_REPOSITORIES
config var:
$ heroku config:set HEROKU_PHP_PLATFORM_REPOSITORIES="https://<your-bucket-name>.s3.<your-bucket-region>.amazonaws.com/heroku-20/packages.json"
To allow the use of multiple custom repositories, the config var may hold a list of multiple repository URLs, separated by a space character, in ascending order of precedence (meaning the last repository listed is handled first by Composer for package lookups).
Please note that Heroku cannot provide support for issues related to custom platform repositories and packages.
Disabling the Default Repository
If the first entry in the list is "-
" instead of a URL, the default platform repository is disabled entirely. This can be useful when testing development repositories, or to forcefully prevent the use of any packages from the default platform repository.
Repository Priorities
It is possible to control Composer Repository Priorities for custom platform repositories: whether Composer should
- treat a given repository as canonical;
- exclude specific packages from a repository;
- only allow specific packages from a repository.
These repository options (canonical
, exclude
and only
) are controlled using the following query strings in the repository URL:
composer-repository-canonical
(true
orfalse
; defaults totrue
)composer-repository-exclude
(comma-separated list of excluded package names)composer-repository-only
(comma-separated list of allowed package names)
For example, the following config var will allow only packages ext-igbinary
and ext-redis
from customrepo.com
; all other packages are looked up in the default repository:
$ heroku config:set HEROKU_PHP_PLATFORM_REPOSITORIES="https://customrepo.com/packages.json?composer-repository-only=ext-igbinary,ext-redis"
Building Custom Repositories
For instructions on how to build custom platform packages (and a repository to hold them), please refer to the instructions further below.
Development
The following information only applies if you're forking and hacking on this buildpack for your own purposes.
Pull Requests
Please submit all pull requests against develop
as the base branch.
Custom Platform Packages and Repositories
Please refer to the README in support/build/
for instructions.