★ The open source department at Spatie is doing overtime
Tags: php, laravel
Published: 2020-01-02 23:01:07

---
title: ★ The open source department at Spatie is doing overtime
published: true
date: 2018-06-01 07:49:29 UTC
tags: php, laravel
canonical_url: https://freek.dev/1070-the-open-source-department-at-spatie-is-doing-overtime
---

Bad title because we [don't do overtime](https://twitter.com/freekmurze/status/949299572689522688) at [Spatie](https://spatie.be), 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](https://github.com/spatie/sheets), created by [Sebastian](https://twitter.com/sebastiandedeyne). 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](https://github.com/sebastiandedeyne/sebastiandedeyne.com/blob/42fb228f87ce3a0ef69a53f68ad49ed0b0e0020b/composer.json#L26) and we're planning on using it on [our guidelines site](https://guidelines.spatie.be) [soon](https://github.com/spatie/guidelines.spatie.be/pull/38).

## typed #

Next we have the [spatie/typed](https://github.com/spatie/typed) package made by [Brent](https://twitter.com/brendt_gd). He's fond of [type systems and strictness](https://www.stitcher.io/blog/liskov-and-type-safety). 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](https://github.com/spatie/typed) package that gives you stuff like typed lists, generics, tuples, structs on much more.

## laravel-view-components #

[Seb](https://twitter.com/sebdedeyne/) released another package, called [spatie/laravel-view-components](https://github.com/spatie/laravel-view-components). It's based on the [Introducing View Components in Laravel, an alternative to View Composers](https://laravel-news.com/introducing-view-components-on-laravel-an-alternative-to-view-composers) post by [Jeff Ochoa](https://twitter.com/@Jeffer_8a). 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](https://docs.spatie.be/laravel-event-projector) to learn how to work with the package. You'll find the source code in [this repo on GitHub](https://github.com/spatie/laravel-event-projector). 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](https://twitter.com/freekmurze/lists/team) to follow them all.