Download the PHP package jakoch/phantomjs-installer without Composer

On this page you can find all versions of the php package jakoch/phantomjs-installer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phantomjs-installer

phantomjs-installer

Latest Stable Version Total Downloads Build Status License

A Composer package which installs the PhantomJS binary (Linux, Windows, Mac) into /bin of your project.

Table of Contents

Installation

To install PhantomJS as a local, per-project dependency to your project, simply add a dependency on jakoch/phantomjs-installer to your project's composer.json file.

For a development dependency, change require to require-dev.

The default download source used is: https://bitbucket.org/ariya/phantomjs/downloads/ You might change it by setting a custom CDN URL, which is explained in the section "Downloading from a mirror".

By setting the Composer configuration directive bin-dir, the vendor binaries will be installed into the defined folder. Important! Composer will install the binaries into vendor\bin by default.

The scripts section is necessary, because currently Composer does not pass events to the handler scripts of dependencies. If you leave it away, you might execute the installer manually.

Now, assuming that the scripts section is set up as required, the PhantomJS binary will be installed into the /bin folder and updated alongside the project's Composer dependencies.

How to require specific versions of PhantomJS?

The environment and server variable PHANTOMJS_VERSION enables you specify the version requirement at the time of packaging.

You can also set the phantomjs-version in the extra section of your composer.json:

The search order for the version is 1) $_ENV, 2) $_SERVER, 3) composer.json (extra section), 4) fallback to v2.1.1 (hardcoded latest version).

How does this work internally?

  1. Fetching the PhantomJS Installer

    In your composer.json you require the package "phantomjs-installer". The package is fetched by composer and stored into ./vendor/jakoch/phantomjs-installer. It contains only one file the PhantomInstaller\\Installer.

  2. Platform-specific download of PhantomJS

    The PhantomInstaller\\Installer is run as a "post-install-cmd". That's why you need the "scripts" section in your "composer.json". The installer creates a new composer in-memory package "phantomjs", detects your OS and downloads the correct Phantom version to the folder ./vendor/jakoch/phantomjs. All PhantomJS files reside there, especially the examples.

  3. Installation into /bin folder

    The binary is then copied from ./vendor/jakoch/phantomjs to your composer configured bin-dir folder.

  4. Generation of PhantomBinary

    The installer generates a PHP file PhantomInstaller\\PhantomBinary and inserts the path to the binary.

PhantomBinary

To access the binary and its folder easily, the class PhantomBinary is created automatically during installation.

The class defines the constants BIN and DIR:

Both constants are also accessible via their getter-methods getBin() and getDir().

Usage:

use PhantomInstaller\PhantomBinary;

// get values with class constants

$bin = PhantomInstaller\PhantomBinary::BIN;
$dir = PhantomInstaller\PhantomBinary::DIR;

// get values with static functions

$bin = PhantomInstaller\PhantomBinary::getBin();
$dir = PhantomInstaller\PhantomBinary::getDir();

This feature is similar to location.js of the phantomjs module for Node.

Override platform requirements

The environment and server variables PHANTOMJS_PLATFORM and PHANTOMJS_BITSIZE enable you to override the platform requirements at the time of packaging. This decouples the packaging system from the target system. It allows to package on Linux for MacOSX or on Windows for Linux.

Possible values for

Downloading from a mirror

You can override the default download location of the PhantomJS binary file by setting it in one of these locations. Listed in order of precedence (highest first):

Default Download Location

The default download location is Bitbucket: https://api.bitbucket.org/2.0/repositories/ariya/phantomjs/downloads/. You don't need to set it explicitly. It's used, when PHANTOMJS_CDNURL is not set.

Mirrors

You might use one of the following mirror URLs as a value for PHANTOMJS_CDNURL:

This list of mirrors is not complete. If you know another mirror, please don't hesitate to add it here.

The mirror URLs are also not hardcoded, except for the Github URL. This enables you to point to any PhantomJS mirror or download folder you like. For instance, you could point to the URL of the download folder of your company, where the binaries are stored: PHANTOMJS_CDNURL=https://cdn.company.com/downloads/phantomjs/.

Automatic download retrying with version lowering on 404

In case downloading an archive fails with HttpStatusCode 404 (resource not found), the downloader will automatically lower the version to the next available version and retry. The number of retries is determined by the number of hardcoded PhantomJS versions in getPhantomJSVersions(). This feature was added, because of the problems with v2.0.0 not being available for all platforms (see issue #25).


All versions of phantomjs-installer with dependencies

PHP Build Version
Package Version
Requires php Version >5.3
ext-bz2 Version *
ext-openssl Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jakoch/phantomjs-installer contains the following files

Loading the files please wait ....