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

Laravel News:
Install Microsoft SQL Drivers for PHP 7 in Docker
Jan 19, 2018 @ 12:51:05

The Laravel News site has a tutorial posted showing the Microsoft SQL Server users out there how to install the drivers and use it in a Laravel application in a Docker environment.

I started a project recently that required that I connect a Microsoft SQL Server database with a the final result when everything is up and running.

tagged: docker laravel microsoft sqlserver driver php7 tutorial

Link: https://laravel-news.com/install-microsoft-sql-drivers-php-7-docker

Christoph Rumpel:
How I redesigned my blog and moved it from Jekyll to Laravel
Jan 18, 2018 @ 09:38:54

Christoph Rumpel has a post to his site sharing the process he followed in migrating his blog site from Jekyll to Laravel. Jekyll is a Ruby based static site generator rather than a dynamic solution like Laravel provides.

One of my resolutions for 2017 was to redesign my blog. One week before the new year I faced myself with the challenge and thought to myself if this was still doable. Somehow I managed it and here it is. In this article I will explain the process and show you how I redesigned the blog with Tailwind CSS and moved it from Jekyll to Laravel with keeping almost the same performance.

He then walks through the entire process, breaking it down into a few different sections:

  • How to start
  • The backend stack
  • Toughest decisions are the ones about design
  • Tailwind CSS
  • Make it fast

For each of the sections there's code, screenshots and links to other resources included.

tagged: jekyll laravel migrate tutorial backend tailwind design css

Link: https://christoph-rumpel.com/2018/01/how-i-redesigned-my-blog-and-moved-it-from-jekyll-to-laravel

Freek Van der Herten:
How to send a "trial expiring soon" mail in Laravel Spark
Jan 15, 2018 @ 10:10:02

Freek Van der Herten has posted a guide to sending an email in a Larvel Spark-based system to remind a user that their trial of a service is expiring soon. In this case, it's a monitoring service he offers called Oh Deal.

I'm currently building a webapp named Laravel Spark, a Laravel based template to kick off SaaS projects. It offers logic for organising users into teams, handles trial periods, subscriptions, payments, invoices and much more.

[...] Unfortunately, Spark will not send out a mail to team owners whose teams are in trial periods that will soon expire. Luckily it's easy to add that yourself. I'll show you how to do just that in this post. Along the way, you'll learn some good general tips for sending out emails in batches. Let's get started!

He then starts in on the code, showing first how to locate the teams that should be sent the email. He adds a new field to track when the email was sent and the code required to send the actual email. He shows how to make the command restartable, create the "Mailable" class and the command to send the actual email.

tagged: team tutorial ohdear ending trial spark laravel mail email

Link: https://murze.be/how-to-send-a-trial-expiring-soon-mail-in-laravel-spark

Laravel News:
Laravel Model Caching
Jan 12, 2018 @ 09:16:25

On the Laravel News site they've posted a tutorial showing you how to use the caching functionality for models based on the framework's Eloquent ORM layer. This caching makes for fewer queries to the database and can improve the overall performance of the application.

You’ve probably cached some model data in the controller before, but I am going to show you a Laravel model caching technique that’s a little more granular using Active Record models. This is a technique I originally learned about on RailsCasts.

Using a unique cache key on the model, you can cache properties and associations on your models that are automatically updated (and the cache invalidated) when the model (or associated model) is updated. A side benefit is that accessing the cached data is more portable than caching data in the controller, because it’s on the model instead of within a single controller method.

They start with an example of it in action, getting the count of comments on a news article based on a relationship. It then shows the use of the touch method to change the model's updated_at timestamp to the current time allowing you to more correctly detect when changes occur. It also includes a more automatic way of performing the same operation using the $touches class property on the model and the cacheKey method to create a unique key name for use in the caching system to reference the model contents.

tagged: model caching laravel tutorial touch updatedat cachekey unique

Link: https://laravel-news.com/laravel-model-caching

Laravel News:
Sending and receiving SMS Laravel Notifications with Nexmo
Jan 11, 2018 @ 10:52:01

The Laravel News site has published a tutorial for those Laravel users out there that would like to integrate their application with Nexmo for the sending and receiving (and handling) of SMS messages in your application.

This is the first part of a series of tutorials by Michael Heap, covering how to build a multi-channel help desk system with Laravel. In this post, we’ll take a basic web based help desk system and extend it to send and receive SMS messages using the built-in Laravel notification system (which is powered by Nexmo).

The tutorial starts with some of the prerequisites you'll need to get started including a Nexmo account and the ngrok tool for exposing your site publicly while still hosting it locally. It then starts in on the functionality, using the Deskmo repository as a starting place. After a few setup steps the article has you hop over to Nexmo and purchase a number to use for the SMS and configure the application to use this number. Next it shows how to send a sample message when a ticket is created and how to receive an incoming SMS message to pull in the information and create a new ticket.

tagged: sms nexmo integration laravel helpdesk tutorial ngrok

Link: https://laravel-news.com/nexmo-sms-laravel-notifications

D. Nagy Gergo:
Neat Laravel Features from 2017
Jan 09, 2018 @ 10:20:01

On his Medium.com site D. Nagy Gergo shares some "neat Laravel features" he's come across in his time developing with the framework.

We passed a year again, (oh, Happy New Year, before we forget), so we decided to collect some features from the Laravel framework that added in the previous year.

There were two big version changes, 5.4 in January and 5.5 in August. Of course, the big releases brought huge changes, but we try to focus on those that added during the year, without any bigger announcement.

In his list he includes functionality like:

  • the "tap" and "when" methods for collection handling
  • API route handling
  • new Blade directives around Guards
  • using "artisan" to build out correct model factories
  • the "firstWhere" method to find and return the first match in a model

Each of the items in the list include a brief summary of the feature and a link to more information about it in the manual.

tagged: laravel features 2017 list description manual

Link: https://medium.com/pine-code/neat-features-in-laravel-from-2017-736096bdf5d2

Freek Van der Herten:
Handling CORS in a Laravel application
Jan 08, 2018 @ 09:47:07

On his blog today Freek Van der Herten has a post introducing a new Laravel package designed to help make CORS implementation simpler in your application. CORS headers are, essentially, what allows clients (like browsers) to talk across domains in a configurable and enforceable fashion.

Recently we released laravel-cors. This package can add the necessary CORS headers of your Laravel app. In this post I'd like to give a quick explanation of what CORS is and how you can use the package.

The post starts by explaining a bit about CORS (Cross-Origin Resource Sharing) headers, what they're used for and simple examples of when they might be most useful. It then covers the package, showing how to pull it into your packages and adding it to the middleware configuration for loading on each request. There's also a more detailed configuration you can use to defined allowed and denied domains as well as the idea of "profiles" for different user levels.

tagged: cors laravel crossorigin resource header package introduction tutorial

Link: https://murze.be/handling-cors-in-a-laravel-application

Zen of Coding:
PHP MVC Frameworks Preview of 2018 (Phalcon 3, Symfony 4, Laravel 5.x and Others)
Jan 05, 2018 @ 13:58:48

On the Zen of Coding site they've posted a look forward at versions of several popular frameworks coming in 2018. Their list includes Phalcon 3, Symfony 4 and Laravel 5.x.

It’s that time of the year again, when we take a look at the world of PHP MVC frameworks. We get ready for the trends of 2018 and plan our roadmaps. Also, we’ll take a quick detour to look at some seagues in the areas beyond PHP MVC.

Web development changes year over year, if not faster. MVC has been a revolutionary paradigm for modern web apps. It helped millions of developers build awesome applications and launch exciting startups.

The post includes a Google Trends chart showing the popularity of searches for various frameworks with Laravel, Symfony and CodeIgniter taking the top three spots overall. It then starts with a high level view of some of the recent changes and trends in several of the frameworks, moving into more detail for each (and some of "the rest" including CakePHP, Zend Framework and Yii. It then discusses microservices, how they relate to MVC and the continuing importance of backend functionality.

tagged: laravel symfony phalcon 2018 preview framework microservices mvc

Link: http://www.zenofcoding.com/2017/12/31/php-mvc-frameworks-preview-of-2018-phalcon-3-symfony-4-laravel-5-x-and-others/

TutsPlus.com:
How to Send Emails in Laravel
Jan 05, 2018 @ 12:25:33

The TutsPlus.com site has posted a tutorial for the Laravel users out there showing you how to send emails with built-in functionality via the framework's Mail API.

In this article, we're going to explore the Mail API in the Laravel web framework. Laravel takes advantage of the popular SwiftMailer library, which is easy to use and comes with a variety of email drivers to choose from. In the latter stages of the article, we'll go through an in-depth demonstration of the concepts discussed in the first half of the article.

The tutorial starts with the setup and configuration you'll need to get the mail system up and running. They don't help you set up the backend (like sendmail or Mailgun) but they do describe the options in the configuration required for methods like SMTP sending and local sending. Next they show an example of a "mailable" class that creates a "demo" email and defines various settings including the "from" address, the content (from a view), variables to pass to the view and an image attachment. The view for the example is also included, making use of the Blade templating to replace placeholders with variable values.

tagged: email laravel tutorial mailable class example

Link: https://code.tutsplus.com/tutorials/how-to-send-emails-in-laravel--cms-30046

Laravel News:
Building a Vue SPA with Laravel
Jan 04, 2018 @ 10:23:08

On the Laravel News site there's a new tutorial posted showing you how to create a Vue.js single page application with Laravel for when you have API-driven applications.

Building a Vue single page application (SPA) with Laravel is a beautiful combination for building clean API-driven applications. In this tutorial, we show you how to get up and running with Vue router and a Laravel backend for building a SPA. We will focus on the wiring up all the pieces needed, and then in a follow-up tutorial, we will further demonstrate using Laravel as the API layer.

They walk you through the creation of a simple SPA that will render the initial content and allow for the browsing back and forth between content without a page reload. The tutorial helps you get all required libraries installed and includes the code to define the Vue router and two routes. The contents of the .vue files are also included as well as the server-side code to power the application.

tagged: laravel vuejs tutorial singlepage application spa introduction

Link: https://laravel-news.com/using-vue-router-laravel