Using Composer with Wampoon
Wampoon includes a fully portable version of Composer that works without global installation. Since Wampoon is portable, it provides batch scripts that configure the PHP path before running Composer.
Available Scripts
Section titled “Available Scripts”Wampoon provides batch scripts that configure the PHP path before running Composer:
| Script | Location | Description |
|---|---|---|
composer.bat | htdocs/ | Convenient script for managing projects in htdocs |
composer.bat | Root folder | Runs Composer with the correct PHP path |
php.bat | Root folder | Runs PHP with the correct environment |
Using Composer
Section titled “Using Composer”To use Composer, open a command prompt and navigate to the htdocs folder, then run commands using composer.bat:
cd C:\Wampoon\htdocscomposer.bat installOr use the full path from any location:
C:\Wampoon\htdocs\composer.bat --working-dir=C:\Wampoon\htdocs\my-project installCommon Commands
Section titled “Common Commands”If you have multiple projects in htdocs, navigate to your project directory first:
cd C:\Wampoon\htdocs\my-project
:: Install dependencies from composer.jsoncomposer.bat install
:: Add a packagecomposer.bat require vendor/package
:: Update all packagescomposer.bat updateCreating a New Project
Section titled “Creating a New Project”Use the composer create-project command to scaffold new applications directly in your htdocs folder.
From the htdocs Folder
Section titled “From the htdocs Folder”Open a command prompt in htdocs and run:
cd C:\Wampoon\htdocscomposer.bat create-project laravel/laravel my-laravel-appPopular Frameworks
Section titled “Popular Frameworks”:: Laravelcomposer.bat create-project laravel/laravel my-app
:: Symfonycomposer.bat create-project symfony/skeleton my-app
:: Slim Frameworkcomposer.bat create-project slim/slim-skeleton my-app
:: CakePHPcomposer.bat create-project cakephp/app my-appAfter creating a project, access it at http://localhost/my-app (or the appropriate entry point for your framework).
Using PHP Directly
Section titled “Using PHP Directly”If you need to run PHP scripts directly, use php.bat from the root folder:
C:\Wampoon\php.bat -vC:\Wampoon\php.bat script.phpAdding to PATH (Optional)
Section titled “Adding to PATH (Optional)”If you frequently use Composer from the command line, you can add the Wampoon folder to your PATH environment variable for the current session:
set PATH=C:\Wampoon;%PATH%Then you can run commands directly:
composer.bat installphp.bat -v