Download the PHP package beyondcode/laravel-visual-diff without Composer

On this page you can find all versions of the php package beyondcode/laravel-visual-diff. 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 laravel-visual-diff

Laravel Visual Diff

Latest Version on Packagist Build Status Quality Score Total Downloads

This package can create a visual diff of two screenshots of your Laravel application. It works for both - regular HTTP tests, as well as tests using Laravel Dusk. Behind the scenes, it uses Pixelmatch to diff the two images.

Here are two basic examples of how the package works:

Using Laravel Dusk:

Using Laravel HTTP Testing:

Requirements

This package requires node 7.6.0 or higher and the Pixelmatch Node library.

You can install the Pixelmatch on MacOS via NPM:

Or you could install it globally

Custom node and npm binaries

Depending on your setup, node or npm might be not directly available to VisualDiff. If you need to manually set these binary paths, you can do this by setting the npm_binary and node_binary config settings in the visualdiff.php configuration file.

Installation

This package can be installed through Composer.

Usage

The package will automatically register the VisualDiffServiceProvider with your Laravel application.

The package adds a new method to either the TestResponse or the Browser class which is called visualDiff. Depending on how you want to create visual diffs, follow the usage guidelines for the Laravel Dusk integration or the HTTP testing integration.

The visualDiff method accepts a name, that will be used for the screenshot generation. If you do not provide a name, the package will try and guess the test name. If this does not work for you, please provide a name manually instead.

Dusk Integration

Just call the visualDiff() method on the Laravel Dusk Browser instance that you use for testing:

This will automatically create a screenshot in all provided resolutions and create a diff, if a previous screenshot is available.

HTTP Testing Integration

Just call the visualDiff() method on the TestResponse instance that you use for testing:

This will automatically create a screenshot in all provided resolutions and create a diff, if a previous screenshot is available.

Dealing with diffs

When VisualDiff detects differences in the new screenshot compared to the previous successfully created screenshot, the PHPUnit test will fail. It will tell you which test caused the visual difference as well as giving you the filename of the screenshot diff.

Now you need to handle with this visual diff, just as you would with a code-diff. Review the changes and either approve the visual difference, or revert the UI state back to the successful state.

You can approve the new screenshots by adding a -d --update-screenshots flag to the phpunit command.

Specify multiple resolutions

Creating diffs for multiple resolutions can be very useful - especially if you want to test responsive websites and applications.

You can define all possible resolutions in your visualdiff.php configuration file:

Alternatively, you may want to only create one specific diff in multiple resolutions. You can do this using the visualDiffForResolutions method and provide an array with the resolutions to test.

See diff results in your terminal window

If you use iTerm2 as your terminal of choice, you will see an image representation of the diff when you run your tests.

iTerm 2

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-visual-diff with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
illuminate/support Version 5.4.*|5.5.*|5.6.*|5.7.*|5.8.*
symfony/process Version ^3.0|^4.0
spatie/browsershot Version ^3.22
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 beyondcode/laravel-visual-diff contains the following files

Loading the files please wait ....