params.json 4.1 KB

1
  1. {"name":"php-phantomjs","tagline":"Execute PhantomJS commands through PHP","body":"Installation\r\n============\r\n\r\nPrerequisites\r\n-------------\r\n\r\nPHP PhantomJS requires PHP **5.3.0** or greater to run.\r\n\r\nInstalling via Composer\r\n-----------------------\r\n\r\nInstall [Composer](https://getcomposer.org/) for your project:\r\n\r\n```Shell\r\n curl -s http://getcomposer.org/installer | php\r\n```\r\n\r\nCreate a `composer.json` file in the root of your project:\r\n\r\n```YAML\r\n {\r\n \"require\": {\r\n \"jonnyw/php-phantomjs\": \"3.*\"\r\n },\r\n \"config\": {\r\n \"bin-dir\": \"bin\"\r\n },\r\n \"scripts\": {\r\n \"post-install-cmd\": [\r\n \"PhantomInstaller\\\\Installer::installPhantomJS\"\r\n ],\r\n \"post-update-cmd\": [\r\n \"PhantomInstaller\\\\Installer::installPhantomJS\"\r\n ]\r\n }\r\n }\r\n```\r\n\r\nIt is important that you have the 'scripts' section shown above in your `composer.json` file as it will install the latest version of PhantomJS for your system to your project's bin folder. It is recommended that you create a bin folder in the root of your project as this is where the PHP PhantomJS library will look for your PhantomJS executable. If you would prefer to use a PhantomJS executable in a custom location, see the [Custom Installation](#custom-installation) section.\r\n\r\nFinally, install the composer depedencies for your project:\r\n\r\n```Shell\r\n php composer.phar install\r\n```\r\n\r\nCustom Installation\r\n-------------------\r\n\r\nIf you would prefer to use a custom install location for the PhantomJS executable, you simply need to tell the client where to find the executable file:\r\n\r\n```php\r\n use JonnyW\\PhantomJs\\Client;\r\n\r\n $client = Client::getInstance();\r\n $client->setPhantomJs('/path/to/phantomjs');\r\n```\r\n\r\nIf you would like composer to install the PhantomJS executable to a custom location when installing dependencies, set the bin dir location in your project's `composer.json` file:\r\n\r\n```YAML\r\n {\r\n \"config\": {\r\n \"bin-dir\": \"/path/to/your/projects/bin/dir\"\r\n }\r\n }\r\n```\r\n\r\nYou will need to make sure that this directory exists and is writable by Composer before running the composer install.\r\n\r\nOnce you have updated your bin location run composer install to install PhantomJS:\r\n\r\n```Shell\r\n php composer.phar install\r\n```\r\n\r\nThis should install the correct PhantomJS executable for your system to the bin locaiton you defined in your `composer.json` file. As mentioned above, you will need to tell the client where to find your PhantomJS executable as it is not installed in the default location:\r\n\r\n\r\n```php\r\n use JonnyW\\PhantomJs\\Client;\r\n\r\n $client = Client::getInstance();\r\n $client->setPhantomJs('/path/to/phantomjs');\r\n```\r\n\r\nInstalling from tarball \r\n-----------------------\r\n\r\nThe PHP PhantomJS library contains several depedencies in order to function so it is recommended that you install it via composer as this will handle your dependencies for you. If you do wish to install it from a [tarball release](https://github.com/jonnnnyw/php-phantomjs/tags) then you will need to install the dependencies manually.\r\n\r\n\r\nThe PHP PhantomJS library currently requires the following depdencies:\r\n\r\n* [Symfony Config Component](https://github.com/symfony/Config) ~2.5\r\n* [Symfony Dependency Injection Component](https://github.com/symfony/DependencyInjection) ~2.5\r\n* [Symfony Filesystem Component](https://github.com/symfony/filesystem) ~2.5\r\n* [Twig templating Component](https://github.com/fabpot/Twig) ~1.16\r\n* [PhantomJS](http://phantomjs.org/) ~1.9\r\n\r\nMake sure the components are in your include path and that the PhantomJS executable is installed to your projects bin folder as mentioned in the [Custom Installation](#custom-installation) section.","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}