PHPackages                             spatie/visit - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. spatie/visit

ActiveProject[HTTP &amp; Networking](/categories/http)

spatie/visit
============

Visit any URL and get its output in a beautiful way.

1.1.0(1y ago)3892.2k14MITPHPPHP ^8.1CI passing

Since Mar 14Pushed 3d ago3 watchersCompare

[ Source](https://github.com/spatie/visit)[ Packagist](https://packagist.org/packages/spatie/visit)[ Docs](https://github.com/spatie/visit)[ GitHub Sponsors](https://github.com/spatie)[ RSS](/packages/spatie-visit/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (14)Versions (19)Used By (0)

Display the response of any URL
===============================

[](#display-the-response-of-any-url)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4e25f9cb3b95305f9d10bf6015716a80d8fd22e02b0ad665e0b7a4f6dcd06508/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f76697369742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/visit)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/2dd3b229793aacfa70d1c0df54c152bb2313f9977e1de3be4798f2f48ba51dcc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7370617469652f76697369742f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/spatie/visit/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/3a99796a3d9f4a0b3e920df2a8ac73ff021791b87263e2f32bb77370d8d091c9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f76697369742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/visit)

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](https://github.com/spatie/visit/raw/main/docs/images/intro.png?raw=true)](https://github.com/spatie/visit/blob/main/docs/images/intro.png?raw=true)

JSON responses will be colorized by default as well.

[![screenshot](https://github.com/spatie/visit/raw/main/docs/images/json.png?raw=true)](https://github.com/spatie/visit/blob/main/docs/images/json.png?raw=true)

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/260e2a1fd7608b722d456418417bfe13757874ce4415135b748e244b45f9d04f/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f76697369742e6a70673f743d31)](https://spatie.be/github-ad-click/visit)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

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](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

Installation
------------

[](#installation)

You can install the package via composer:

```
composer global require spatie/visit
```

To colorize HTML, you should install [bat 0.20 or higher](https://github.com/sharkdp/bat).

On macOS you can install bat using brew.

```
brew install bat
```

To colorize JSON, you should install [jq](https://stedolan.github.io/jq/).

On macOS you can install jq using brew.

```
brew install jq
```

Usage
-----

[](#usage)

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

```
visit spatie.be
```

[![screenshot](https://camo.githubusercontent.com/eee49d6b94f5774863cb36562718c0dc60ee80dfa06679755606047d59713a73/68747470733a2f2f7370617469652e6769746875622e696f2f76697369742f696d616765732f68746d6c2e706e67)](https://camo.githubusercontent.com/eee49d6b94f5774863cb36562718c0dc60ee80dfa06679755606047d59713a73/68747470733a2f2f7370617469652e6769746875622e696f2f76697369742f696d616765732f68746d6c2e706e67)

### Using a different method

[](#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.

```
visit  --method=delete
```

### Following redirects

[](#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.

```
php artisan visit /my-page --follow-redirects
```

### Passing a payload

[](#passing-a-payload)

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

```
visit  --payload='{"testKey":"testValue"}'
```

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.

```
visit  --method=patch --payload='{"testKey":"testValue"}'
```

### Showing the headers of the response

[](#showing-the-headers-of-the-response)

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

```
visit  /my-page --headers
```

[![screenshot](https://github.com/spatie/visit/raw/main/docs/images/headers.png?raw=true)](https://github.com/spatie/visit/blob/main/docs/images/headers.png?raw=true)

### Only displaying the response

[](#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.

```
visit  --only-response
```

### Only displaying the response properties block

[](#only-displaying-the-response-properties-block)

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

```
visit  --only-stats
```

### Avoid colorizing the response

[](#avoid-colorizing-the-response)

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

```
visit  --no-color
```

### Displaying the result HTML as text

[](#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.

```
visit  --text
```

### Filtering HTML output

[](#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](https://www.w3schools.com/cssref/css_selectors.asp).

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

```

        First div
        First paragraph
        Second paragraph

```

This command ...

```
visit  --filter="p"
```

... will display:

```
First paragraph
Second paragraph
```

### Filtering JSON output

[](#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:

```
{
    "firstName": "firstValue",
    "nested": {
        "secondName": "secondValue"
    }
}
```

This command ...

```
visit  --filter="nested.secondName"
```

... will display:

```
secondValue
```

### Ignoring SSL Errors

[](#ignoring-ssl-errors)

If you want the `visit` command to bypass SSL certificate verification (useful for testing against local development servers with self-signed certificates), you can use the `--ignore-ssl-errors` option.

```
visit  --ignore-ssl-errors
```

This will allow you to make requests to endpoints with invalid or untrusted SSL certificates without the request failing.

**Note:** Use this option carefully. Bypassing SSL verification compromises the security of your request and should only be used for testing purposes.

Laravel integration
-------------------

[](#laravel-integration)

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

- logging in a user
- visiting a route name
- reporting the amount of queries performed and models hydrated to build up the response.

To enable this, you must install [the spatie/laravel-visit package](https://github.com/spatie/laravel-visit) 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](https://github.com/spatie/visit/raw/main/docs/images/relative.png?raw=true)](https://github.com/spatie/visit/blob/main/docs/images/relative.png?raw=true)

Your can use these extra options:

- `--user`: you can pass this option a user id or email that will be logged in before rendering the response
- `--route`: pass this option the name of a route, you don't have to specify an url anymore. For example `visit --route=contact`
- `--show-exceptions`: when your app throws an exception, this option will show that exception.

Here's an example of the `route` option:

[![screenshot](https://github.com/spatie/visit/raw/main/docs/images/laravel1.png?raw=true)](https://github.com/spatie/visit/blob/main/docs/images/laravel1.png?raw=true)

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

[![screenshot](https://github.com/spatie/visit/raw/main/docs/images/laravel2.png?raw=true)](https://github.com/spatie/visit/blob/main/docs/images/laravel2.png?raw=true)

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance75

Regular maintenance activity

Popularity38

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 71.9% 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 ~64 days

Recently: every ~252 days

Total

17

Last Release

439d ago

Major Versions

0.0.9 → 1.0.02022-03-23

PHP version history (2 changes)0.0.1PHP ^8.0

1.0.6PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7535935?v=4)[Spatie](/maintainers/spatie)[@spatie](https://github.com/spatie)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (110 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (17 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (13 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (4 commits)")[![1allen](https://avatars.githubusercontent.com/u/597599?v=4)](https://github.com/1allen "1allen (2 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (2 commits)")[![samuelroland](https://avatars.githubusercontent.com/u/47849646?v=4)](https://github.com/samuelroland "samuelroland (2 commits)")[![xiCO2k](https://avatars.githubusercontent.com/u/823088?v=4)](https://github.com/xiCO2k "xiCO2k (1 commits)")[![thecaliskan](https://avatars.githubusercontent.com/u/13554944?v=4)](https://github.com/thecaliskan "thecaliskan (1 commits)")[![nazmulpcc](https://avatars.githubusercontent.com/u/8166346?v=4)](https://github.com/nazmulpcc "nazmulpcc (1 commits)")

---

Tags

curlurlvisiturlcurldebuggingvisit

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/spatie-visit/health.svg)

```
[![Health](https://phpackages.com/badges/spatie-visit/health.svg)](https://phpackages.com/packages/spatie-visit)
```

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k997.0M2.7k](/packages/guzzlehttp-psr7)[symfony/routing

Maps an HTTP request to a set of configuration variables

7.6k775.6M1.6k](/packages/symfony-routing)[rmccue/requests

A HTTP library written in PHP, for human beings.

3.6k33.8M227](/packages/rmccue-requests)[league/uri

URI manipulation library

1.1k196.3M232](/packages/league-uri)[league/uri-interfaces

Common tools for parsing and resolving RFC3987/RFC3986 URI

537194.9M19](/packages/league-uri-interfaces)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48246.1M329](/packages/php-http-curl-client)

PHPackages © 2026

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