https://github.com/syntaxc4-msft/composerextension
Brings Composer Support to Azure Websites via a Site Extension
https://github.com/syntaxc4-msft/composerextension
azure composer php
Last synced: 10 months ago
JSON representation
Brings Composer Support to Azure Websites via a Site Extension
- Host: GitHub
- URL: https://github.com/syntaxc4-msft/composerextension
- Owner: SyntaxC4-MSFT
- License: mit
- Created: 2014-10-17T00:22:34.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2022-08-01T19:50:12.000Z (almost 4 years ago)
- Last Synced: 2025-08-19T11:28:58.839Z (10 months ago)
- Topics: azure, composer, php
- Language: HTML
- Homepage: http://www.siteextensions.net
- Size: 132 KB
- Stars: 15
- Watchers: 0
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README



# Azure App Service Web App Composer Site Extension
This site extension adds [Composer](http://getcomposer.org) support to Web App to enable dependency management for PHP applications.
## Installation
Follow the instructions outlined in the article [How to enable a Site Extension in Azure App Service Web App](http://blog.syntaxc4.net/post/2015/02/05/how-to-enable-a-site-extension-in-azure-websites.aspx) when selecting an extension look for the list item for [Composer](http://www.siteextensions.net/packages/ComposerExtension/).
## Usage
There are multiple ways to use Composer from Web App.
### Continuous Deployment
This [sample application](https://github.com/SyntaxC4-MSFT/WAWS-Composer) demonstrates the usage of the `composer.json` file in Web App.
* Place a `composer.json` file in the root of your repository
* vendor folder will be created in `d:\home\site\wwwroot\vendor` (there is a rewrite rule enabled in the extension to protect against public access to the `vendor` folder)
* reference to the autoload.php file `require_once "vendor/autoload.php";`
### Command-Line
* Open the Kudu Debug Console (http://<site-name>.scm.azurewebsites.net/DebugConsole) or Install [KuduExec](https://github.com/projectkudu/kuduexec)
* run composer from the command line `composer selfupdate`
### Timeout configuration
In some cases (especially when attempting to install great amount of packages, [#1](https://github.com/SyntaxC4-MSFT/ComposerExtension/issues/1)) the deployment may timeout and the dependencies won't get loaded correctly by Composer. A simple fix is to add a [deployment configuration](https://github.com/projectkudu/kudu/wiki/Customizing-deployments) (create `.deployment` file) with parameter [**SCM_COMMAND_IDLE_TIMEOUT**](https://github.com/projectkudu/kudu/wiki/Configurable-settings) and set it to bigger number (for example `SCM_COMMAND_IDLE_TIMEOUT=600` where 600 is time out in seconds). The default value in Azure Web Apps for this setting appears to be 400 seconds.
## AppSettings
| Name | Value |Notes |
|---------------------|---------------------------------------|------------------------------------------|
| APPSETTING_COMMAND | %XDT_EXTENSIONPATH%\Hooks\deploy.cmd | Deployment Hook Command. |
| PATH | %PATH%;%XDT_EXTENSIONPATH%\Commands;%APPDATA%\Composer\vendor\bin | Overwrites the Path. Last Extension Wins |
| COMPOSER_ARGS | --prefer-dist --no-dev --optimize-autoloader --no-progress | Command line arguments for composer during deploy.cmd execution |