{"id":24801365,"url":"https://github.com/urlbox/urlbox-php","last_synced_at":"2025-07-08T06:34:08.603Z","repository":{"id":16804293,"uuid":"80672726","full_name":"urlbox/urlbox-php","owner":"urlbox","description":"PHP composer package to generate website thumbnail screenshots using urlbox.io","archived":false,"fork":false,"pushed_at":"2024-10-11T10:43:00.000Z","size":59,"stargazers_count":11,"open_issues_count":4,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-09T08:11:24.752Z","etag":null,"topics":["browser","headless","laravel","phantomjs","php","png","preview","render","responsive","screenshot","screenshot-library","screenshots","site","thumbnail","thumbnails","webpage","webpage-screenshot","website-preview","website-screenshot","website-thumbnail"],"latest_commit_sha":null,"homepage":"https://urlbox.io","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/urlbox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2017-02-01T22:50:19.000Z","updated_at":"2024-05-09T12:38:38.000Z","dependencies_parsed_at":"2024-04-30T10:39:18.905Z","dependency_job_id":"9f023cd2-308b-410c-9c61-c4a125de30f4","html_url":"https://github.com/urlbox/urlbox-php","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urlbox%2Furlbox-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urlbox%2Furlbox-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urlbox%2Furlbox-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urlbox%2Furlbox-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/urlbox","download_url":"https://codeload.github.com/urlbox/urlbox-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236298335,"owners_count":19126500,"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":["browser","headless","laravel","phantomjs","php","png","preview","render","responsive","screenshot","screenshot-library","screenshots","site","thumbnail","thumbnails","webpage","webpage-screenshot","website-preview","website-screenshot","website-thumbnail"],"created_at":"2025-01-30T04:28:23.221Z","updated_at":"2025-01-30T04:28:23.658Z","avatar_url":"https://github.com/urlbox.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Urlbox/Screenshots\n\n## Capture highly accurate webpage screenshots of any site using Urlbox.io in PHP\n\nThis package uses the [Urlbox.io](https://urlbox.io) screenshot as a service to generate website screenshots.\n\n## Installation\n\nThis package can be installed through Composer.\n\n```bash\ncomposer require urlbox/screenshots\n```\n\n\n### Laravel Setup\n\nWhen using Laravel, if you are using a version pre v5.5 you will need to include the Service Provider manually:\n\n```php\n// app/config/app.php\n\n'providers' =\u003e [\n    // ...\n    'Urlbox\\Screenshots\\UrlboxProvider'\n];\n```\n\nSetup your API keys:\n\n```php\n// config/services.php\n\n'urlbox' =\u003e [\n    'key'    =\u003e env('URLBOX_KEY'),\n    'secret' =\u003e env('URLBOX_SECRET'),\n    'webhook_secret' =\u003e env('URLBOX_WEBHOOK_SECRET'),\n];\n```\n\nand in your .env file:\n\n```bash\n# URLBOX\nURLBOX_KEY=YOUR_URLBOX_KEY\nURLBOX_SECRET=YOUR_URLBOX_SECRET\nURLBOX_WEBHOOK_SECRET=YOUR_URLBOX_WEBHOOK_SECRET\n```\n\nYou can find your API Credentials and Webhook Secret [here](https://www.urlbox.io/dashboard/projects)\n\n## Usage\n\nYou will need a [Urlbox](https://urlbox.io) account to use this package. Please signup [here](https://urlbox.io/pricing) and get your API Key and Secret from the Urlbox dashboard once you have logged in.\n\nHere is a sample call to generate a Urlbox screenshot URL:\n\n```php\n    use Urlbox\\Screenshots\\Urlbox;\n    $urlbox = Urlbox::fromCredentials( 'API_KEY', 'API_SECRET' );\n    \n    $options = [\n        // only required option is a url:\n        'url' =\u003e 'example.com',\n        \n        // specify any other options to augment the screenshot...\n        'width' =\u003e 1280,\n        'height' =\u003e 1024,\n    ];\n    \n    // Create the Urlbox URL\n    $urlboxUrl = $urlbox-\u003egenerateSignedUrl( $options );\n    // $urlboxUrl is now 'https://api.urlbox.io/v1/API_KEY/TOKEN/png?url=example.com'\n    \n    // Generate a screenshot by loading the Urlbox URL in an img tag:\n    echo '\u003cimg src=\"' . $urlboxUrl . '\" alt=\"Test screenshot generated by Urlbox\"\u003e'\n```\n\nIf you're using Laravel and have set up the service provider, you can use the Facade provided:\n\n```php\nuse Urlbox\\Screenshots\\Facades\\Urlbox;\n\n$options = [ 'url' =\u003e 'example.com' ];\n$urlboxUrl = Urlbox::generateUrl( $options );\n// $urlboxUrl is now 'https://api.urlbox.io/v1/API_KEY/TOKEN/png?url=example.com'\n```\n\nYou can now use the result (`$urlboxUrl`) by placing it inside an `\u003cimg/\u003e` tag as the `src` parameter.\n\nWhen you load the image, a screenshot of example.com will be returned.\n\n## Options\n\nYou can find the full list of available options within the [docs](https://urlbox.io/docs/options). Below is a list of the most commonly used options:\n\n| Option          | Default           | Description                                                                                                                                                                                                                                                                                                                       |\n|-----------------|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `url`           | -                 | The URL of the website you want to screenshot **(Required)**                                                                                                                                                                                                                                                                      |\n| `width`         | 1280              | Viewport width of the browser in pixels                                                                                                                                                                                                                                                                                           |\n| `height`        | 1024              | Viewport height of the browser in pixels                                                                                                                                                                                                                                                                                          |\n| `selector`      | -                 | Take a screenshot of the element that matches this selector                                                                                                                                                                                                                                                                       |\n| `thumb_width`   | -                 | Width in pixels of the generated thumbnail, leave off for full-size screenshot                                                                                                                                                                                                                                                    |\n| `format`        | png               | Image format of the resulting screenshot image (`png` or `jpg`)                                                                                                                                                                                                                                                                   |\n| `user_agent`    | -                 | User-Agent string used to emulate a particular client.                                                                                                                                                                                                                                                                            |\n| `cookie`        | -                 | Set a cookie value before taking a screenshot. E.g. OptIn=true. Can be set multiple times to set more than one cookie.                                                                                                                                                                                                            |\n| `delay`         | -                 | Amount of time to wait in milliseconds before urlbox takes the screenshot                                                                                                                                                                                                                                                         |\n| `wait_for`      | -                 | Waits for the element specified by this selector to be visible on the page before taking a screenshot                                                                                                                                                                                                                             |\n| `timeout`       | 30000             | Amount of time to wait in milliseconds for the website at url to respond                                                                                                                                                                                                                                                          |\n| `full_page`     | false             | Specify whether to capture the full-length of the website                                                                                                                                                                                                                                                                         |\n| `flash`         | false             | Enable the flash plugin for flash using websites                                                                                                                                                                                                                                                                                  |\n| `force`         | false             | Take a fresh screenshot instead of getting a cached version                                                                                                                                                                                                                                                                       |\n| `ttl`           | 2592000 (30 days) | Short for 'time to live'. Number of seconds to keep a screenshot in the cache. Note the default is also the maximum value for this option.                                                                                                                                                                                        |\n| `quality`       | 80                | JPEG only - image quality of resulting screenshot (0-100)                                                                                                                                                                                                                                                                         |\n| `disable_js`    | false             | Turn off javascript on target url to prevent popups                                                                                                                                                                                                                                                                               |\n| `retina`        | false             | Take a 'retina' or high definition screenshot equivalent to setting a device pixel ratio of 2.0 or @2x. Please note that retina screenshots will be double the normal dimensions and will normally take slightly longer to process due to the much bigger image size.                                                             |\n| `click`         | -                 | Element selector that is clicked before taking a screenshot e.g. #clickme would click the element with id=\"clickme\"                                                                                                                                                                                                               |\n| `hover`         | -                 | Element selector that is hovered before taking a screenshot e.g. #hoverme would hover over the element with id=\"hoverme\"                                                                                                                                                                                                          |\n| `bg_color`      | -                 | Hex code or css color string. Some websites don't set a body background colour, and will show up as transparent backgrounds with PNG or black when using JPG. Use this setting to set a background colour. If the website explicitly sets a transparent background on the html or body elements, this setting will be overridden. |\n| `crop_width`    | -                 | Crop the width of the screenshot to this size in pixels                                                                                                                                                                                                                                                                           |\n| `hide_selector` | -                 | Hides all elements that match the element selector by setting their style to `display:none !important;`. Useful for hiding popups.                                                                                                                                                                                                |\n| `highlight`     | -                 | Word to highlight on the page before capturing a screenshot                                                                                                                                                                                                                                                                       |\n| `highlightfg`   | white             | Text color of the highlighted word                                                                                                                                                                                                                                                                                                |\n| `highlightbg`   | red               | Background color of the highlighted word                                                                                                                                                                                                                                                                                          |\n| `use_s3`        | false             | Save the screenshot directly to the S3 bucket configured on your account                                                                                                                                                                                                                                                          |\n| `webhook_url`   | -                 | Urlbox will send a POST request back to the supplied URL with data about the screenshot in JSON format once it has completed rendering.                                                                                                                                                                                           |\n\n***\n\n## Other implementations\n\n* [Node.js](https://github.com/urlbox-io/urlbox-screenshots-node)\n\n## Contributing\n\nWe are open to pull requests.\n\n## Security\n\nIf you discover any security related issues, please email services@urlbox.io instead of using the issue tracker.\n\n## About Urlbox\n\nUrlbox is a premium Screenshot as a Service API. It lets you render highly accurate screenshots of webpages and display them anywhere you like. [Urlbox.io](https://urlbox.io).\n\n## License\n\nThe MIT License (MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furlbox%2Furlbox-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Furlbox%2Furlbox-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furlbox%2Furlbox-php/lists"}