Every time our team releases a package I have the habit of writing an introductory blogpost. But after the initial release most pages gain more features through PRs by the community and ourselves. Mostly these new feature go unnoticed. That's why I plan on regularly writings posts on noteworthy changes across our repos.

Browsershot

This package makes it easy to convert any webpage (or html string) to an image or a pdf. Under the hood headless Chrome is leveraged. A while ago I took the time to add a new bodyHtml method to it. Here's how that can be used:

Browsershot::url('https://spatie.be')->bodyHtml();

The method returns the html of the dom after JavaScript has been executed. Pretty cool.

Among our packages there's also a powerful crawler. bodyHtml paved the way for making that crawler execute JavaScript as well. So now it can also find links that were injected by JavaScript scripts on your site.

Our laravel-sitemap package uses that crawler to automatically create a sitemap of your site. Now that the crawler can execute JavaScript, the sitemap generator can now add pages which are linked to by JavaScript injected links.

laravel-medialibrary

Our medialibrary is a pretty powerful package that can associate all sort of files with eloquent models. Here's a video that demonstrates what the package is capable of.

A PR by Alex Vanderbist makes it possible to generate temporary URLs to files that are stored on S3.

Here's how you can do that

$yourModel
   ->getMedia()
   ->first()
   ->getTemporaryUrl(Carbon::now()->addMinutes(5), 'thumb'); // Temporary S3 url

laravel-translatable

This package makes it easy make eloquent models translatable. Translations are stored as json. There is no extra table needed to hold them. Previously a translation should be set like this:

$yourModel->setTranslation('name', 'en', 'Name in English')

A PR by flofloflo adds an alternative way to go about this:

// assuming your the locale of the app is set to `en`
$yourModel->name = 'Name in English

Feels much more natural.

laravel-demo-mode

Our demo mode package provides a middleware that can protect your work in progress from prying eyes. Visitors should first visit a specific (secret) url before they can see that content of the project you're building.

A PR by Alex Vanderbist added these two options to the config file that make it possible to make a whitelist on an IP address basis.

/**
 * The following IP addresses will automatically have access to the app
 * without having to pass the `demoAccess` route.
 */
'authorized_ips' => [

],

/**
 * If strict mode is enabled then only the IP addresses listed in `authorized_ips` are allowed.
 * Vistors won't be able to gain access by visiting the  `demoAccess` route anymore.
 */
'strict_mode' => false,