Oh Dear is the all-in-one monitoring tool for your entire website. We monitor uptime, SSL certificates, broken links, scheduled tasks and more. You'll get a notifications for us when something's wrong. All that paired with a developer friendly API and kick-ass documentation. O, and you'll also be able to create a public status page under a minute. Start monitoring using our free trial now.

The open source department at Spatie is doing overtime

Original – by Freek Van der Herten – 3 minute read

Bad title because we don't do overtime at Spatie, but our team has been very busy putting out new open source stuff. In the past weeks our team has released three new packages. In this post I'd like to quickly introduce them too you.

sheets

First up is spatie/sheets, created by Sebastian. This package helps you in storing and retrieving content that is saved in plain text files. This is great if you have a blog or site that uses markdown files instead of a database to store content. Seb is already using this for his personal site and we're planning on using it on our guidelines site soon.

typed

Next we have the spatie/typed package made by Brent. He's fond of type systems and strictness. PHP's type system has a lot of room for improvement. Probably these improvements should be done in the core, but a lot can be done in userland as well. That's why Brent created the spatie/typed package that gives you stuff like typed lists, generics, tuples, structs on much more.

laravel-view-components

Seb released another package, called spatie/laravel-view-components. It's based on the Introducing View Components in Laravel, an alternative to View Composers post by Jeff Ochoa. It lets you build component classes that can be easily rendered in a Blade view. Here's a quick example taken from the readme:

namespace App\Http\ViewComponents;

use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Contracts\Auth\Guard;
use Spatie\Menu\Laravel\Menu;

class MainMenuComponent implements Htmlable
{
    /** @var \Illuminate\Contracts\Auth\Guard */
    private $guard;

    /** @var string */
    private $class;

    public function __construct(Guard $guard, string $class = null)
    {
        $this->guard = $guard;
        $this->class = $class;
    }

    public function toHtml(): string
    {
        $menu = Menu::new()
            ->addClass($this->class)
            ->url('/', 'Home')
            ->url('/projects', 'Projects');

        if ($this->guard->check()) {
            $menu->url('/admin', 'Adminland');
        }

        return $menu;
    }
}
@render('mainMenuComponent', ['class' => 'background-green'])

We're using this now in a client project and it's really a beautiful way to work.

laravel-event-projector

Finally I'm busy creating a bigger package that aims to be the easiest way to get started with Event Sourcing in a Laravel application. It's not quite ready for prime time yet, but as usual I'm building it in the open. You can already read some documentation to learn how to work with the package. You'll find the source code in this repo on GitHub. I welcome any questions and suggestions on how to make this package better on the issue tracker of that repo. My aim is to release it somewhere in June.

There's still more in the pipeline. To stay current with our team is doing in the open source space follow our members on Twitter. Here's a handy twitter list to follow them all.

Stay up to date with all things Laravel, PHP, and JavaScript.

You can follow me on these platforms:

On all these platforms, regularly share programming tips, and what I myself have learned in ongoing projects.

Every month I send out a newsletter containing lots of interesting stuff for the modern PHP developer.

Expect quick tips & tricks, interesting tutorials, opinions and packages. Because I work with Laravel every day there is an emphasis on that framework.

Rest assured that I will only use your email address to send you the newsletter and will not use it for any other purposes.

Comments

What are your thoughts on "The open source department at Spatie is doing overtime"?

Comments powered by Laravel Comments
Want to join the conversation? Log in or create an account to post a comment.