Introducing Laravel Playground

Published on

Introducing Laravel Playground

I'm super excited to finally reveal a project that I have been working on for a couple of months already. The overall development was pretty time consuming and it involves a lot of interesting challenges to make this work - but I feel like it's finally in a state that I feel good about sharing with others.

Say hello to Laravel Playground:

What is Laravel Playground?

Laravel Playground is a sandbox for your Laravel code and the spiritual successor of Tinkerwell Web. Laravel Playground makes it easy to quickly tinker with any PHP and Laravel code right in your browser. You can embed it into your blog, documentation or website easily!

While the code for Tinkerwell Web was running entirely in your browser, Laravel Playground is running your code on actual servers. This allows you to quickly try out features such as request validation, multiple Laravel routes or even Livewire components!

To get started with Laravel Playground, you can go ahead and take a look at this basic example:

In this example, we are creating two Laravel routes that each display a simple view. Try clicking on the link to the other route and you will see that the URL changes and the other view gets loaded.

This embedded Playground is also editable. You can click on the arrow next to the filename to open the file selection. Feel free to modify one of the views or the route definition file. Now press Ctrl+Enter to reload the code - boom you have updated the snippet right in your browser!

If you want to open the playground in a full-screen editor, just click on the "Edit on Laravel Playground" link on the upper right of the embed. This will open up with your embedded code prefilled. There you have the same ability to edit your code snippet and run your code.

Livewire support

Laravel Playground comes pre-installed with a hand full of useful Laravel packages. As you can see, the Laravel Debugbar is enabled by default. Another package that you can make use of is Livewire.

Let's take a look at how this works:

As you can see, this playground gives you a ready-to-use Livewire component that you can modify and play with.

When you are on the Laravel Playground website, you can quickly create a new Livewire project (or choose from one of the other available presets) by clicking on the "+" button.

Eloquent models and database support

Laravel playground also allows you to persist data to a SQLite database within each playground. All migrations that you create will automatically be migrated.

Embedding Playgrounds

As you can already see in this blog posts, embedding your code is a big feature of Laravel Playground. That's why we made it extremely simple to embed your code - while still maintaining total control of your code on your own website, documentation or blog.

Let's say that you want to include this piece of PHP code in your blog post:

$slice = Str::of('This is my name')->after('This is');

Laravel Playgrounds prefill embeds can now execute this PHP code for you in a sandboxed environment. This means that you keep your code on your website and Laravel Playground executes and renders it for you.

Here's the example code embedded:

$slice = Str::of('This is my name')->after('This is');

The embed code that makes this work is very developer friendly. You can keep your code wrapped in <pre> or <code> blocks on your website and wrap them in a <div> with attributes that control the embed, like this:

<pre data-filename="index.php">
$slice = Str::of('This is my name')->after('This is');
<script src=""></script>

When embedding your code you can configure and customize quite a lot of things, such as the theme, making embeds read-only, which file to open by default, to show or hide the result/code view, etc.

Closing note

As I said in the beginning of this post: I'm super excited to finally share this with all of you as I've been working on this for a very long time. I hope you like Laravel Playground as much as I do and I can't wait to see it being used in blog-posts all over the place.

If you want to learn more, check out the official documentation on the Beyond Code website.

Read more

HELO giveaway

Published on

Last week I announced that we at Beyond Code have been working on a pretty cool new app called HELO.

It's a desktop application for Windows, Mac and Linux that will make it super easy to test and debug your application mails during development.

Read more

Carbon for your desktop

Published on – 3 minute read

🎨 Create and share beautiful images of your source code.

I'm a huge fan of Carbon - an open source project and website that lets you easily create and download great looking code snippets, like this one here:

Read more

PHP Package Development giveaway!

Published on

I'm super excited to announce that we are giving away 5 PHP Package Development Pro video courses!

More than 2,000 developers have already taken my course and learned how to build reusable PHP packages. The video course contains more than 30 lessons and covers all topics required for you to start writing your own PHP package. It not only focuses on generic PHP packages but also contains a lot of extra videos that cover Laravel specific PHP package development!

You can enter the giveaway using the form below:

Read more

2019 - My year in review

Published on – 13 minute read

A lot of other people, like my friends Freek, Dries and Nuno have already posted their 2019 recap posts and I'm a bit late to the party, so here goes mine. I've been enjoying the christmas holidays and haven't touched my Macbook for the last 10 days, which was super relaxing for me, as I tend to…

Read more

Laravel Form Requests - more than validation

Published on – 8 minute read

Laravel form requests are one of the most underrated features, maybe even a bit "hidden" inside the Laravel framework. Don't just take my word for granted - here's what Taylor Otwell thinks about it: Truth 👌— Taylor Otwell 🏝 (@taylorotwell) October 7,…

Read more

Embracing simplicity in your code

Published on – 9 minute read

Before I start going into any details in this blog post, I want us to have the same definition of the meaning of "simplicity" and "simple" that I am referring to in this article. I have created many online video courses over the last couple of years, have given on-site trainings…

Read more

Customizing Ignition with custom solutions

Published on – 3 minute read

Last Friday, my friend Freek Van der Herten and I announced two big projects that we've been working on for the last 8 months.

Flare - an error tracker built specifically for Laravel. You can find out all about it in our extensive blogpost and get on the early access list on the Flare homepage.

And Ignition a beautiful error page for your Laravel applications. It becomes the default error page in Laravel 6.

Read more

Catching incoming emails in your Laravel application with Laravel Mailbox

Published on

While working on a client project over the last couple of weeks, one of the requested features was the ability to fetch incoming emails in the Laravel application. Using services such as Mailgun or Sendgrid, this is perfectly possible, since they offer support for webhooks where they send you either the raw email content, or a parsed version of it so that you can process the message.

Read more

Polishing your code

Published on – 9 minute read

While preparing content for my upcoming PHP Package Development video course I discovered that over the last couple of years I spend more and more time polishing my code before shipping it.

And I believe that this is something that is just as important as the actual coding itself.

Let me talk you through some of the adjustments that I try to make, while working on my codebase and how this can hopefully affect your way of writing good and readable code.

Read more

2018 - my year in review

Published on – 10 minute read

As a lot of other people have started to post their write-ups on how 2018 went for them, I want to join them and tell you a little about what happened to me throughout the last 12 months. I think this is also a great way for me to recap what I have achieved over the last year. So here we go.…

Read more

Finding N+1 Queries in Laravel

Published on – 4 minute read

Using Laravel's Eloquent Active-Record, it becomes incredibly easy to define relations between your models. But with all this ease of use, developers might not notice that their application could be suffering in terms of performance, because of underlying database calls. To give you a better…

Read more

Introducing Laravel Dusk Dashboard

Published on – 10 minute read

Laravel Dusk Dashboard is a Laravel package that gives you a beautiful Dashboard for your Dusk test suites. It completely visualizes the individual steps that are involved when your Dusk tests are running, as well as DOM snapshots for each individual step. This makes it super useful when trying to debug your browser tests and to figure out what they are doing in the background. You can also make use of your browsers debug tools to inspect the DOM snapshots.

Read more

PHP Package Design

Published on – 11 minute read

Over the 7 years I have writte a lot of open- and closed-source packages in various programming languages. Most of them were written in PHP, but I've also spent a couple of years writing Objective-C and Java packages. But the days that I've written Objective-C or Java are long gone, so this post will focus on PHP. But most of the techniques and design principles can also be applied to any other programming language.

Read more

Visual Regression Testing with Laravel

Published on – 2 minute read

I'm not sure how you feel, but I consider myself a backend developer. Sure - I know my way around Vue.JS and really enjoy working with it, but writing CSS has never been my strong point.

At one of our companies recent projects, we are working together with another development team, which is mostly taking care of frontend development. So we build controllers, repositories, services, etc. and hand it over to some basic views. They handle the rest.

We introduced continuous integration to them and showed them our usual workflow, when I thought that it would be excellent to also have some kind of visual CI for frontend changes.

That's what this package is all about.

Read more