Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Pineco.de:
Implementing Laravel’s Authorization on the Front-End
Sep 27, 2017 @ 10:15:56

On the Pineco.de site there's a tutorial posted showing you how to implement the Laravel auth system on the frontend re-using the same logic in a single-page Vue.js application as you would on the backend.

If you are using Laravel, probably you are familiar with its ACL. You can easily restrict user’s access by creating policies and binding them to the specific models. It works perfectly on the back-end, but what can we do if our app is something like an SPA?

The post starts with a brief overview of the Laravel ACL handling as it relates to users and policies about what they can do or access. The frontend setup then makes use of a "cheap copy" of the Laravel "gate" handling via a Javascript-based request. They walk you through the preparation work you'll need and the creation of a gate class to define the current policies for CRUD methods. The main "Gate" class is then defined, setting up the before, allow and deny action methods. Finally these pieces are integrated into the Vue.js application with an example of either showing or hiding the "Edit" link based on the user permissions.

tagged: laravel authentication gate frontend vuejs tutorial gate logic javascript

Link: https://pineco.de/implementing-laravels-authorization-front-end/

Delicious Brains:
Announcing serializededitor.com: A Visual Editor for PHP Serialized Data
Jun 28, 2017 @ 09:22:23

On the Delicious Brains site there's a new post from Gilbert Pellegram announcing serializededitor.com, an editor specifically designed to help visually edit serialized PHP data.

I recently built a command line daemon in PHP to emulate AWS SQSD for the purposes of testing in Mergebot. As it turns out, one of the benefits of building a large, complex product like Mergebot is that there are pieces of the system that we need to build for the project that might be of use to other developers.

Today, we’re launching that system piece, a free online visual editor for PHP serialized data as serializededitor.com.

In this article, I’ll explain how and why we built this “side” project and how I overcame some of the challenges I faced when building this project.

He starts off with the problem they were trying to solve when creating the editor, mostly centered around determining the differences between two pieces of serialized data. They found something similar to what they were wanting but it didn't provide the "easy editiing" functionality they wanted. He then goes through some of the issues they bumped up against along the way: working with the data and PHP's unserialize, the creation of their own parser, the work to create the Vue.js frontend and re-serializing the data once complete.

They've also open sourced the project over on GitHub so you can clone it locally and contribute back.

tagged: serialized data editor project introduction github vuejs

Link: https://deliciousbrains.com/announcing-serializededitor-com-visual-editor-php-serialized-data/

Freek Van der Herten:
Building a realtime dashboard powered by Laravel and Vue (2017 edition)
Jun 27, 2017 @ 09:53:33

Freek van der Herten has a recent post to his site sharing a project that was created by the team at Spatie to show real-time information on a large display there in the office. In his post he details how this system was created using Laravel for the backend and Vue.js for the frontend.

At Spatie we have a tv screen against the wall that displays a dashboard. This dashboard displays the tasks our team should be working on, important events in the near future, which music is playing at our office, and so on.

We’ve opensourced our dashboard, so you can view the entire source code on GitHub. It is built with Laravel 5.4 and Vue.

He goes through some of the history behind the project and how it was designed to replace some initial efforts with Dashing. He covers the basic functionality of the system with a high level overview and what kind of information it's displaying. From there he gets into more of the technical details of the dashboard including the grid setup, server-side code, client side Vue.js functionality and packages involved.

tagged: dashboard laravel vuejs tutorial github opensource display

Link: https://murze.be/2017/06/building-realtime-dashboard-powered-laravel-vue-2017-edition/

Matt Stauffer:
Removing all Vue dependencies from Laravel
Mar 15, 2017 @ 10:17:01

In a new tutorial on his site Matt Stauffer shows how to remove the Vue.js dependencies from a standard Laravel installation. There's only a few but they're installed by default and if you're not using Vue.js they can easily be removed.

The recent versions of Laravel have come with some very minor Vue dependencies out of the box. They're easy to remove, but you may have not actually tried that yet, or you might be worried you're going to leave something sitting there. So, here's a quick tip on how to remove all Vue dependencies in a new Laravel install in a few easy steps.

The process is broken down into a few steps:

  • Install Laravel
  • Drop Vue from package.json
  • Drop the bootstrap and the sample component

The changes you'll need to make to the configuration files are included so the removal process is pretty painless.

tagged: laravel remove vuejs tutorial steps javascript

Link: https://mattstauffer.co/blog/removing-all-vue-dependencies-from-laravel

Symfony Finland:
Sharing state in a Symfony hybrid with Twig, React and other JavaScript apps
Jan 26, 2017 @ 11:14:12

The Symfony Finland site has posted a new tutorial showing you how you can share state in a Symfony application between Twig, React and other Javascript-based applications.

Front end development has certainly grown up in the last few years. UI logic is increasingly being moved to the client side, but the traditional server-rendered views aren't going anywhere soon. And they shouldn't.

The two methods will live alongside each other and you'll have to work with two worlds. Let's explore an idea how to make this pleasant to work with, by sharing state between Twig templates and JavaScript.

The post starts with some background on a case where this kind of sharing was a requirement and, while the initial version was scrapped, a prototype application was born. He details what this prototype showcases (which JS libraries) and links to the Javascript involved over on GitHub. They then get into the code examples showing the creation of an AppState object that handles the serializing of the state information and store the result in the database via a Doctrine connection. This value is then output to the pages that require it, making it available to the frontend application (Vue.js, React or plain Javascript).

tagged: tutorial symfony shared state backend frontend javascript twig react vuejs

Link: https://www.symfony.fi/entry/sharing-state-in-a-symfony-hybrid-app-with-twig-react-etc

Three Devs & A Maybe:
Checking in with Lew and hearing about Blue n' Vue
Jan 10, 2017 @ 10:48:14

The Three Devs & A Maybe podcast, with hosts Michael Budd, Fraser Hart, Lewis Cains and Edd Mann, has posted their latest episode today - Checking in with Lew and hearing about Blue n' Vue:

In this weeks episode we have a long overdue catch-up with Lew. We start off by discussing what he has been up to, and a certain four-legged addition to his family. From here we move on to chat about working on a product vs. working in an agency setting, picking your battles when refactoring and not being scared to make mistakes. Finally, we highlight how Edd has recently used personal Homebrew taps, using Android simulators for testing and Lew’s experience with Vue.js.

You can listen to this latest episode either through the in-page audio player or by downloading the mp3 directly. If you enjoy the show, be sure to subscribe to their feed and follow them on Twitter for updates when new shows are released.

tagged: threedevsandamaybe podcast lew vuejs homebrew

Link: http://threedevsandamaybe.com/checking-in-with-lew-and-hearing-about-blue-n-vue/

Matt Stauffer:
Using Vue in Laravel 5.3, with the Vue bootstrap and sample component
Dec 23, 2016 @ 09:18:29

Matt Stauffer has posted the next article in his series of "What's New in Laravel 5.3" series with this article covering the use of Vue.js with Laravel and some of the bootstrapping that makes it easier.

In Laravel 5.3, it's easier than ever to write and use Vue components out of the box. This means 5.3 has a somewhat more opinionated default frontend stack than previous versions do. But never fear—it's easy to strip out the default components.

Let's explore 5.3's JavaScript stack together. Spin up a sample app using the Laravel installer (or, if you're like me, use Lambo) and open up the site in your favorite IDE.

He starts with the sample definitions of the package.json and Gulp files, including some dependencies including Vue.js itself and the Vue Resource packages. He then shows a sample app.js file to define the main part of the application and a matching bootstrap.js with a bit of, well, bootstrapping for the application. Finally he creates the example component, runs yarn/gulp and updates a Blade template to lay out the main application div and include the application Javascript file. Finally he shows what the resulting application should look like with screenshot included.

tagged: laravel vuejs tutorial introduction gulp yarn elixir javascript framework

Link: https://mattstauffer.co/blog/using-vue-in-laravel-5-3-with-the-vue-bootstrap-and-sample-component

Scotch.io:
Handling Laravel Validation Error Messages With Vue.js
Nov 02, 2016 @ 10:32:28

The Scotch.io blog has posted a new tutorial for the Laravel+Vue.js users out there helping you effectively handle validation error messages output through the Vue.js portion of the application.

Recently, I launched a open source side project I was working on called Open Laravel. Open Laravel allows developers to submit open source projects that were built using the Laravel framework. The project submission page uses Vue.js to submit the form asynchronously through an AJAX request. Since I am no longer sending the form the default way (refreshing after form submission), I needed a way to show Laravel form validation error messages. After going back and forth with some forum questions and answers, I was able to make it work.

The tutorial starts you out with a fresh install of Laravel and runs a npm install to get the Laravel Elixir dependencies. They then add in the other dependencies (like Vue.js itself and the use-resource package). Next up are changes on the Laravel side: adding required routes, setting up a "Posts" controller and making a simple view with the form to take in post content. They provide the Javascript for the Vue.js side as well, making use of the vue-resource to connect the form with the POST request to the backend. Finally they tie in the "FormError" component and have it either show failure messages or success messages when everything's good.

tagged: tutorial vuejs laravel form submit vueresoruce error message

Link: https://scotch.io/tutorials/handling-laravel-validation-error-messages-with-vue-js

Matt Stauffer:
Introducing Laravel Passport
Aug 01, 2016 @ 09:35:05

In his continuing series of posts looking at the upcoming features in the next version of the Laravel framework (v5.3) Matt Stauffer has posted about a new security-related offering that was recently announced at the Laracon US conference: Laravel Passport.

API authentication can be tricky. OAuth 2 is the reigning ruler of the various standards that you might consider, but it's complex and difficult to implement—even with the great packages available (League and Luca).

[...] Laravel Passport is native OAuth 2 server for Laravel apps. Like Cashier and Scout, you'll bring it into your app with Composer. It uses the League OAuth2 Server package as a dependency but provides a simple, easy-to-learn and easy-to-implement syntax.

He briefly mentions the "groundwork" that was laid for Passport in v5.2 and the application of different authentication mechanisms at different times. He then moves into the installation and configuration of the Passport system (it's not bundled so it's a separate install). He then talks about the management API that's automatically set up, the Vue.js frontend for managing clients and tokens and what it looks like when one is requested. He also provides a bit of sample code you can use to test it out for yourself once you've created a client and token on your system. He ends the post talking about the command line token generation of "personal" tokens and using middleware "scopes" to allow for easier cross-authorizations between routes.

tagged: laravel passport oauth api package release vuejs client token tutorial

Link: https://mattstauffer.co/blog/introducing-laravel-passport

Freek Van der Herten:
Building a dashboard using Laravel and Vue
Jun 09, 2016 @ 18:55:17

Freek Van der Herten has a post to his site showing you how to combine Vue.js and Laravel to make a dashboard, a simple way to display statistics and information in a "quick glance" format.

At Spatie we have tv screen against the wall that displays a dashboard. This dashboard displays the tasks that our team should be working on, important events in the near future, which music is playing at our office, and so on. We’ve opensourced our dashboard, so you can view the entire source code on GitHub. It is built with Laravel and Vue. In this post I’d like to explain why and how we made it.

He starts with a bit of history around their need for the dashboard and how previous versions (using Dashing) turned out. He gives a high level overview of what he was trying to accomplish and why he chose Vue.js. He then gets into the construction of the pieces of the dashboard:

  • the grid
  • the internet connection (server and client side)
  • the package statistics component

He also talks about the security they added to the system (protecting the dashboard from outside eyes) and how they displayed it on a TV using a Raspberry Pi.

tagged: dashboard vuejs tutorial laravel frontend backend

Link: https://murze.be/2016/06/building-dashboard-using-laravel-vue/