Download the PHP package spatie/visit without Composer

On this page you can find all versions of the php package spatie/visit. 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 visit

Display the response of any URL

Latest Version on Packagist GitHub Code Style Action Status Total Downloads

This tool can display the response of any URL. Think of it as curl for humans. By default, the output will be colorized. The response code and response time will be displayed after the response.

screenshot

JSON responses will be colorized by default as well.

screenshot

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Installation

You can install the package via composer:

To colorize HTML, you should install bat 0.20 or higher.

On macOS you can install bat using brew.

To colorize JSON, you should install jq.

On macOS you can install jq using brew.

Usage

To visit a certain page, execute visit followed by a URL.

screenshot

Using a different method

By default, the visit command will make GET request. To use a different HTTP verb, you can pass it to the method option.

Following redirects

By default, the visit command will not follow redirects. To follow redirects and display the response of the redirection target, add the --follow-redirects option.

Passing a payload

You can pass a payload to non-GET request by using the payload. The payload should be formatted as JSON.

When you pass a payload, we'll assume that you want to make a POST request. If you want to use another http verb, pass it explicitly.

Showing the headers of the response

By default, visit will not show any headers. To display them, add the --headers option

screenshot

Only displaying the response

If you want visit to only display the response, omitting the response result block at the end, pass the --only-response option.

Only displaying the response properties block

To avoid displaying the response, and only display the response result block, use the --only-stats option

Avoid colorizing the response

visit will automatically colorize any HTML and JSON output. To avoid the output being colorized, use the --no-color option.

Displaying the result HTML as text

Usually an HTML response is quite lengthy. This can make it hard to quickly see what text will be displayed in the browser. To convert an HTML to a text variant, you can pass the --text option.

Filtering HTML output

If you only want to see a part of an HTML response you can use the --filter option. For HTML output, you can pass a css selector.

Imagine that your app's full response is this HTML:

This command ...

... will display:

Filtering JSON output

If you only want to see a part of an JSON response you can use the --filter option. You may use dot-notation to reach nested parts.

Imagine that your app's full response is this JSON:

This command ...

... will display:

Laravel integration

The visit command can also reach into a Laravel app and do stuff like:

To enable this, you must install the spatie/laravel-visit package inside your Laravel app.

To visit a route in your Laravel app, make sure you execute visit when the current working directory is your Laravel app. You should also use a relative URL (so omit the app URL).

screenshot

Your can use these extra options:

Here's an example of the route option:

screenshot

In the stats block at the end you'll see the amount of queries and models hydrated.

screenshot

Testing

Changelog

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

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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


All versions of visit with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
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 spatie/visit contains the following files

Loading the files please wait ....