{"id":14989946,"url":"https://github.com/spatie/visit","last_synced_at":"2025-05-16T18:06:33.762Z","repository":{"id":40559212,"uuid":"467827371","full_name":"spatie/visit","owner":"spatie","description":"See the response of any URL in a beautiful way","archived":false,"fork":false,"pushed_at":"2025-05-12T17:48:41.000Z","size":35591,"stargazers_count":386,"open_issues_count":0,"forks_count":12,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-12T18:46:58.894Z","etag":null,"topics":["curl","url","visit"],"latest_commit_sha":null,"homepage":"https://freek.dev/2216-introducing-visit-a-cli-tool-made-for-humans-to-make-networks-requests","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spatie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"spatie"}},"created_at":"2022-03-09T07:48:50.000Z","updated_at":"2025-05-12T17:48:38.000Z","dependencies_parsed_at":"2024-04-29T18:42:55.767Z","dependency_job_id":"804948dd-e42d-4be2-80d2-6190797b055c","html_url":"https://github.com/spatie/visit","commit_stats":{"total_commits":112,"total_committers":7,"mean_commits":16.0,"dds":0.2321428571428571,"last_synced_commit":"427bd562140c070e425d113643ce533d5b3cca5c"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fvisit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fvisit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fvisit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Fvisit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spatie","download_url":"https://codeload.github.com/spatie/visit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253805845,"owners_count":21967053,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["curl","url","visit"],"created_at":"2024-09-24T14:19:12.521Z","updated_at":"2025-05-16T18:06:33.719Z","avatar_url":"https://github.com/spatie.png","language":"PHP","funding_links":["https://github.com/sponsors/spatie"],"categories":[],"sub_categories":[],"readme":"# Display the response of any URL\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/visit.svg?style=flat-square)](https://packagist.org/packages/spatie/visit)\n[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/spatie/visit/Check%20\u0026%20fix%20styling?label=code%20style)](https://github.com/spatie/visit/actions?query=workflow%3A\"Check+%26+fix+styling\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/spatie/visit.svg?style=flat-square)](https://packagist.org/packages/spatie/visit)\n\nThis 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.\n\n![screenshot](https://github.com/spatie/visit/blob/main/docs/images/intro.png?raw=true)\n\nJSON responses will be colorized by default as well.\n\n![screenshot](https://github.com/spatie/visit/blob/main/docs/images/json.png?raw=true)\n\n## Support us\n\n[\u003cimg src=\"https://github-ads.s3.eu-central-1.amazonaws.com/visit.jpg?t=1\" width=\"419px\" /\u003e](https://spatie.be/github-ad-click/visit)\n\nWe 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).\n\nWe 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).\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer global require spatie/visit\n```\n\nTo colorize HTML, you should install [bat 0.20 or higher](https://github.com/sharkdp/bat). \n\nOn macOS you can install bat using brew.\n\n```bash\nbrew install bat\n```\n\nTo colorize JSON, you should install [jq](https://stedolan.github.io/jq/).\n\nOn macOS you can install jq using brew.\n\n```bash\nbrew install jq\n```\n\n## Usage\n\nTo visit a certain page, execute `visit` followed by a URL.\n\n```bash\nvisit spatie.be\n```\n\n![screenshot](https://spatie.github.io/visit/images/html.png)\n\n### Using a different method\n\nBy default, the `visit` command will make GET request. To use a different HTTP verb, you can pass it to the `method` option.\n\n```bash\nvisit \u003cyour-url\u003e --method=delete\n```\n\n### Following redirects\n\nBy default, the `visit` command will not follow redirects. To follow redirects and display the response of the redirection target, add the `--follow-redirects` option.\n\n```bash\nphp artisan visit /my-page --follow-redirects\n```\n\n### Passing a payload\n\nYou can pass a payload to non-GET request by using the payload. The payload should be formatted as JSON.\n\n```bash\nvisit \u003cyour-url\u003e --payload='{\"testKey\":\"testValue\"}'\n```\n\nWhen 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.\n\n```php\nvisit \u003cyour-url\u003e --method=patch --payload='{\"testKey\":\"testValue\"}'\n```\n\n\n\n### Showing the headers of the response\n\nBy default, `visit`  will not show any headers. To display them, add the `--headers` option\n\n```bash\nvisit \u003cyour-url\u003e /my-page --headers\n```\n\n![screenshot](https://github.com/spatie/visit/blob/main/docs/images/headers.png?raw=true)\n\n### Only displaying the response\n\nIf you want `visit` to only display the response, omitting the response result block at the end, pass the `--only-response` option.\n\n```bash\nvisit \u003cyour-url\u003e --only-response\n```\n\n### Only displaying the response properties block\n\nTo avoid displaying the response, and only display the response result block, use the `--only-stats` option\n\n```bash\nvisit \u003cyour-url\u003e --only-stats\n```\n\n### Avoid colorizing the response\n\n`visit` will automatically colorize any HTML and JSON output. To avoid the output being colorized, use the `--no-color` option.\n\n```bash\nvisit \u003cyour-url\u003e --no-color\n```\n\n### Displaying the result HTML as text\n\nUsually 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.\n\n```bash\nvisit \u003cyour-url\u003e --text\n```\n\n### Filtering HTML output\n\nIf 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).\n\nImagine that your app's full response is this HTML:\n\n```html\n\u003chtml\u003e\n    \u003cbody\u003e\n        \u003cdiv\u003eFirst div\u003c/div\u003e\n        \u003cp\u003eFirst paragraph\u003c/p\u003e\n        \u003cp\u003eSecond paragraph\u003c/p\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n\nThis command ...\n\n```bash\nvisit \u003cyour-url\u003e --filter=\"p\"\n```\n\n... will display:\n\n```html\n\u003cp\u003eFirst paragraph\u003c/p\u003e\n\u003cp\u003eSecond paragraph\u003c/p\u003e\n```\n\n### Filtering JSON output\n\nIf 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.\n\nImagine that your app's full response is this JSON:\n\n```json\n{\n    \"firstName\": \"firstValue\",\n    \"nested\": {\n        \"secondName\": \"secondValue\"\n    }\n}\n```\n\nThis command ...\n\n```bash\nvisit \u003cyour-url\u003e --filter=\"nested.secondName\"\n```\n\n... will display:\n\n```html\nsecondValue\n```\n\n### Ignoring SSL Errors\n\nIf you want the `visit` command to bypass SSL certificate verification (useful for testing against local development\nservers with self-signed certificates), you can use the `--ignore-ssl-errors` option.\n\n```bash\nvisit \u003cyour-url\u003e --ignore-ssl-errors\n```\n\nThis will allow you to make requests to endpoints with invalid or untrusted SSL certificates without the request\nfailing.\n\n**Note:** Use this option carefully. Bypassing SSL verification compromises the security of your request and should only be used for testing purposes.\n\n\n## Laravel integration\n\nThe `visit` command can also reach into a Laravel app and do stuff like:\n\n- logging in a user\n- visiting a route name\n- reporting the amount of queries performed and models hydrated to build up the response.\n\nTo enable this, you must install [the spatie/laravel-visit package](https://github.com/spatie/laravel-visit) inside your Laravel app.\n\nTo 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).\n\n![screenshot](https://github.com/spatie/visit/blob/main/docs/images/relative.png?raw=true)\n\nYour can use these extra options:\n\n- `--user`: you can pass this option a user id or email that will be logged in before rendering the response\n- `--route`: pass this option the name of a route, you don't have to specify an url anymore. For example `visit --route=contact`\n- `--show-exceptions`: when your app throws an exception, this option will show that exception.\n\nHere's an example of the `route` option:\n\n![screenshot](https://github.com/spatie/visit/blob/main/docs/images/laravel1.png?raw=true)\n\nIn the stats block at the end you'll see the amount of queries and models hydrated.\n\n![screenshot](https://github.com/spatie/visit/blob/main/docs/images/laravel2.png?raw=true)\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Freek Van der Herten](https://github.com/freekmurze)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Fvisit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspatie%2Fvisit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Fvisit/lists"}