lesekloden / lesekloden-screenshots
Capture page sections as PNG screenshots in Laravel using Browsershot.
Fund package maintenance!
Requires
- php: ^8.3
- illuminate/console: ^12.0||^13.0
- illuminate/filesystem: ^12.0||^13.0
- illuminate/support: ^12.0||^13.0
- spatie/browsershot: ^5.4
Requires (Dev)
- larastan/larastan: ^3.9
- laravel/pao: ^1.0
- laravel/pint: ^1.29
- orchestra/testbench: ^10.0||^11.0
- pestphp/pest: ^4.6||^5.0
- pestphp/pest-plugin-laravel: ^4.1||^5.0
- pestphp/pest-plugin-type-coverage: ^4.0||^5.0
- phpstan/extension-installer: ^1.4
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
This is a thin wrapper around Browsershot for creating custom screenshots for the Norwegian learning portal Lesekloden.no.
Setup
Install the package in a Laravel 12 or 13 project using PHP 8.3 or later. Install Puppeteer and its browser, with Node.js and npm available on your PATH:
composer require lesekloden/lesekloden-screenshots
npm install puppeteer
php artisan vendor:publish --tag="lesekloden-screenshots-config"
In config/screenshots.php, set paths to the URLs, application paths, or named routes to capture:
'paths' => ['/about', 'route:home', ['route' => 'home', 'name' => 'hero']], 'output_directory' => 'storage/app/private/screenshots',
String entries capture full pages. Entries with a name capture the element with the matching attribute, such as data-screenshot="hero".
Set APP_URL to your running application, then generate the PNG files:
php artisan generate:screenshots
Output is saved in page subdirectories under storage/app/private/screenshots.
Updating an existing installation
If you previously installed directly from GitHub, remove that repository entry and switch to the stable release:
composer config --unset repositories.lesekloden-screenshots composer require lesekloden/lesekloden-screenshots:^1.0 --with-all-dependencies
For subsequent compatible releases:
composer update lesekloden/lesekloden-screenshots
Review the changelog before updating. To add new settings to an already published config file, compare it with vendor/lesekloden/lesekloden-screenshots/config/screenshots.php and merge the changes into your application's config.
Development and releases
Run composer install and composer test before pushing changes. Use Conventional Commits (or squash-merge PRs with a Conventional Commit title):
fix: ...for a patch release.feat: ...for a minor release.feat!: ...or aBREAKING CHANGE:footer for a major release.
After the current main commit passes CI, release-please prepares or updates a release PR with the next version and changelog. Review and merge that PR to publish the GitHub release and version tag; the Packagist webhook then indexes it automatically. No repeated Packagist submission or manual tag is needed.
Update this README in the same PR whenever installation, requirements, configuration, or usage changes. Documentation-only changes do not normally require a release.
The workflow uses GitHub's built-in token. Its generated release PRs do not trigger additional CI runs; the merged main commit must pass the full test suite before a release is created. Package versions come from Git tags, so do not add a version field to composer.json.