I'm trying to use PHP PhantomJS but it's require some package to run .. I'm composer in php and when I'm trying to install dependencies on root PHP PhantomJS
composer install
says
Loading composer repositories with package information
Installing dependencies (including require-dev)
Nothing to install or update
Generating autoload files
I'm confused ... anybody can help how install package that's need to run PHP PhantomJS script?
If you downloaded it, you have everything you need without using Composer. Composer is for downloading this and other packages, but this is not the only way of getting packages. :)
Now the easiest way to use that package is to have a new clean empty directory and execute this line:
composer require jonnyw/php-phantomjs:2.*
Now magic happens, including the creation of a composer.json file, download of that package, creation of autoloading files, and then you are done.
With an otherwise empty directory you couldn't do very much, so in order to make use of that package (or others) inside your own code, go to the root directory of your code, and execute above line. The same things happen, and then you are pretty much done - apart from the fact that you need to include the autoloader file in your own code if you want to use that package.
Install PhantomJS via Composer
Use the package "jakoch/phantomjs-installer".
It installs the PhantomJS binary for Linux, Windows or Mac into the /bin
folder of your project.
Simply add the following lines to your projects composer.json
file:
{
"require": {
"jakoch/phantomjs-installer": "3.0.0"
},
"scripts": {
"post-install-cmd": [
"PhantomInstaller\\Installer::installPhantomJS"
],
"post-update-cmd": [
"PhantomInstaller\\Installer::installPhantomJS"
]
},
"config": {
"bin-dir": "bin"
}
}
The version number determines which version of PhantomJS is fetched.
Execute composer update
or composer install
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With