PHPackages                             garoi/laravel-phantomjs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. garoi/laravel-phantomjs

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

garoi/laravel-phantomjs
=======================

Use phantom-js in laravel

1.1.7(3y ago)02MITPHPPHP ^7.3

Since May 8Pushed 3y agoCompare

[ Source](https://github.com/garoi/laravel-phantomjs)[ Packagist](https://packagist.org/packages/garoi/laravel-phantomjs)[ RSS](/packages/garoi-laravel-phantomjs/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (16)Used By (0)

[![Build Status](https://camo.githubusercontent.com/495b2a9e2557d1533489af2dac16bf491957e3f0065fb39cabe24b445c22184a/68747470733a2f2f6170692e7472617669732d63692e6f72672f4d724a6f73684c61622f6c61726176656c2d7068616e746f6d6a732e7376673f6272616e63683d646576656c6f70)](https://travis-ci.org/MrJoshLab/laravel-phantomjs)[![Latest Stable Version](https://camo.githubusercontent.com/a8802a486cb772d53b42bc9ca6367874301d046d84fd3b080bde733035f805eb/68747470733a2f2f706f7365722e707567782e6f72672f6a6f73682f6c61726176656c2d7068616e746f6d6a732f762f737461626c65)](https://packagist.org/packages/josh/laravel-phantomjs)[![Total Downloads](https://camo.githubusercontent.com/96a7ef72e0ab896ac775a6fcced0ec3432c884dd1a8e875b3054af4d531c7644/68747470733a2f2f706f7365722e707567782e6f72672f6a6f73682f6c61726176656c2d7068616e746f6d6a732f646f776e6c6f616473)](https://packagist.org/packages/josh/laravel-phantomjs)[![Latest Unstable Version](https://camo.githubusercontent.com/7951d7ee2bb1aece419a875fb73d2880cab80292f4311de07d92f79891de0954/68747470733a2f2f706f7365722e707567782e6f72672f6a6f73682f6c61726176656c2d7068616e746f6d6a732f762f756e737461626c65)](https://packagist.org/packages/josh/laravel-phantomjs)[![Discord](https://camo.githubusercontent.com/2060dad62de53f0af42ad69e45c8931bb4638ef00f652e03d236165c24715c73/68747470733a2f2f646973636f72646170702e636f6d2f6170692f6775696c64732f3431353536363736343639373538333632382f656d6265642e706e67)](https://discord.gg/bHR599t)[![License](https://camo.githubusercontent.com/b243a1d9059a7a58929da441fb738660bb983633022e98f8769ef26315e360e9/68747470733a2f2f706f7365722e707567782e6f72672f6a6f73682f6c61726176656c2d7068616e746f6d6a732f6c6963656e7365)](https://packagist.org/packages/josh/laravel-phantomjs)

Laravel PhantomJs Client
========================

[](#laravel-phantomjs-client)

Using php-phantomjs client in laravel

[php-phantomjs Documentation](http://jonnnnyw.github.io/php-phantomjs/)

Requirement
===========

[](#requirement)

- [laravel/framework ^6](https://github.com/laravel/laravel)
- [jonnyw/php-phantomjs 4.\*](https://github.com/jonnnnyw/php-phantomjs)

Install
-------

[](#install)

Via Composer

```
$ composer require josh/laravel-phantomjs
```

Config
------

[](#config)

Add the following provider to providers part of config/app.php

```
Josh\Component\PhantomJs\PhantomJsServiceProvider::class
```

and the following Facade to the aliases part

```
'PhantomJs' => Josh\Component\PhantomJs\Facade\PhantomJs::class
```

and then you can run vendor:publish command for generating phantomjs config file

```
$ php artisan vendor:publish --provider="Josh\Component\PhantomJs\PhantomJsServiceProvider"
```

#### Now you can config your phantomjs client in `config/phantomjs.php` file

[](#now-you-can-config-your-phantomjs-client-in-configphantomjsphp-file)

Basic Usage
-----------

[](#basic-usage)

The following illustrates how to make a basic GET request and output the page content:

### On Load Finished

[](#on-load-finished)

```
// Tells the client to wait for all resources before rendering

$request = \PhantomJs::get('https://www.google.com/');

\PhantomJs::isLazy()->send($request);
```

```
// you can use Facade or app make function to use phantomjs
// ex: app('phantomjs') or \PhantomJs

$request = \PhantomJs::get('https://www.google.com/');

$response = \PhantomJs::send($request);

if($response->getStatus() === 200) {

    // Dump the requested page content
    echo $response->getContent();
}
```

Saving a screen capture to local disk:

```
$request = \PhantomJs::createImage('https://www.google.com/', 'GET');

$request->setOutputFile(public_path('file.jpg'));

$request->setViewportSize(800, 600);

$request->setCaptureDimensions(800, 600, 0, 0);

$response = \PhantomJs::send($request);

if($response->getStatus() === 200) {

    // Dump the requested page content
    echo $response->getContent();
}
```

Outputting a page as PDF:

```
$request = \PhantomJs::createPdf('https://www.google.com/', 'GET');
$request->setOutputFile(public_path('document.pdf'));
$request->setFormat('A4');
$request->setOrientation('landscape');
$request->setMargin('1cm');

$response = \PhantomJs::send($request);

if($response->getStatus() === 200) {

    // Dump the requested page content
    echo $response->getContent();
}
```

License
-------

[](#license)

The MIT License (MIT)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 88.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~133 days

Recently: every ~294 days

Total

15

Last Release

1426d ago

Major Versions

0.0.4 → 1.0.02018-02-12

PHP version history (3 changes)1.0.0PHP ^7.1

1.1.5PHP ^7.2

1.1.7PHP ^7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/d61eb9b06e7054721d7175c811fa2cd73ee95c2c375ffce04a2ecf643f1dcce0?d=identicon)[garoi](/maintainers/garoi)

---

Top Contributors

[![mrjosh](https://avatars.githubusercontent.com/u/9644368?v=4)](https://github.com/mrjosh "mrjosh (45 commits)")[![cognitus](https://avatars.githubusercontent.com/u/2235718?v=4)](https://github.com/cognitus "cognitus (2 commits)")[![garoi](https://avatars.githubusercontent.com/u/5613434?v=4)](https://github.com/garoi "garoi (2 commits)")[![nioperas06](https://avatars.githubusercontent.com/u/11293401?v=4)](https://github.com/nioperas06 "nioperas06 (1 commits)")[![p2p-sys](https://avatars.githubusercontent.com/u/37340795?v=4)](https://github.com/p2p-sys "p2p-sys (1 commits)")

---

Tags

laravelphantomjsphantomjs-phpphantom-js

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/garoi-laravel-phantomjs/health.svg)

```
[![Health](https://phpackages.com/badges/garoi-laravel-phantomjs/health.svg)](https://phpackages.com/packages/garoi-laravel-phantomjs)
```

###  Alternatives

[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341682.2k18](/packages/gehrisandro-tailwind-merge-laravel)[whitecube/laravel-timezones

Store UTC dates in the database and work with custom timezones in the application.

106106.2k](/packages/whitecube-laravel-timezones)[forxer/laravel-gravatar

A library providing easy gravatar integration in a Laravel project.

4235.6k](/packages/forxer-laravel-gravatar)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

116.6k](/packages/tomshaw-electricgrid)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
