PHP code example of youwe / composer-dependency-installer
1. Go to this page and download the library: Download youwe/composer-dependency-installer library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
youwe / composer-dependency-installer example snippets
declare(strict_types=1);
namespace Acme\Foo;
class Bar
{
public function __construct(
private readonly DependencyInstaller $dependencyInstaller
) {}
public function installUpstreamRepository(): void
{
$this->dependencyInstaller->installRepository(
name: 'some/package',
type: 'composer',
url: 'mypackagedomain.dev'
);
}
public function installUpstreamPackage(): void
{
$this->dependencyInstaller->installPackage(
name: 'some/package',
version: '^2.0.0',
dev: true, // Whether it should be a dev dependency (e.g.