1. Click to open the link on Composer Chinese website
2. Create an execution script in the project directory
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
3. Execute the script
php composer-setup.php
4. Delete files
php -r "unlink('composer-setup.php');"
----------------------------------------------------------------------------------------------------------------------------------
Extension:
Install phpmailer with composer (third-party mailboxes are not supported, so you can use nette/mail instead)
1. Click on the extension address to open the link , and run it in the composer installation directory.
./composer.phar require phpmailer/phpmailerNote: This method is to download directly from abroad, and the speed is slow. You can use the Chinese mirror to download by modifying the composer configuration.
./composer.phar config -g repo.packagist composer https://packagist.phpcomposer.com
----------------------------------------------------------------------------------------------------------------------------------
*The same way to install nette/mail
./composer.phar require nette/mail
2. Extension usage
All extensions installed through composer can directly import autoload.php
require __DIR__ '/vendor/autoload.php'; use Nette\Mail\Message;