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

Laravel News:
Navigating a New Laravel Codebase
Mar 07, 2018 @ 17:57:50

For those out there that are new to using the Laravel framework and are a bit lost in trying to figure out its structure, Laravel News has just the article for you. In this new tutorial they give you an overview of the Laravel codebase and how you should structure your applications to keep everything organized.

Getting started in a new codebase can be very overwhelming, even more so if you are new to programming. So where do you start? Where are the places to look to learn the most about a codebase? Let’s take a look at few common areas for Laravel.

They start by talking about project documentation and how it can play a vital role in the on-boarding of developers new to the application. From there the post goes on to talk about the composer.json configuration, route configurations, service providers, tests and some additional tooling. For each item there's a paragraph or two explaining its place in a Laravel application and, in some cases, links to other resources for more information.

tagged: laravel codebase navigate documentation composer serviceprovider test tool route

Link: https://laravel-news.com/navigating-a-new-laravel-codebase

TutsPlus.com:
How to Register & Use Laravel Service Providers
Jul 20, 2017 @ 19:08:19

On the TutsPlus.com site they've posted a new tutorial showing you how to register and use service providers in Laravel and how it relates to the service container functionality.

If you've ever come across the Laravel framework, it's highly unlikely that you haven't heard of service containers and service providers. In fact, they're the backbone of the Laravel framework and do all the heavy lifting when you launch an instance of any Laravel application.

In this article, we're going to have a glimpse of what the service container is all about, and following that we'll discuss the service provider in detail. In the course of this article, I'll also demonstrate how to create a custom service provider in Laravel.

The article starts with an overview of the service container and service providers, describing what they are and providing some example code/configuration to clarify the concepts. It then gets into the creation of your own custom service provider. In their case they create a provider that doesn't really do anything but it does help to show how to make it, register it and put it to use in a controller.

tagged: tutorial register use laravel service provider serviceprovider container

Link: https://code.tutsplus.com/tutorials/how-to-register-use-laravel-service-providers--cms-28966

DotDev.co:
Creating a custom queue driver for Laravel
Feb 10, 2017 @ 01:21:04

On the DotDev.co blog there's a new post showing you how to create a custom queue driver for Laravel allowing you to define the logic and handling for background job processing with the framework.

Ever needed to use a queue service not supported by Laravel? No, me neither! However, recently I needed to tweak the config for the SQS driver in order to utilise a couple of the Amazon configuration settings. Unfortunately, these settings are not natively exposed by Laravel, so I decided to build my own driver. Here’s how it went.

The tutorial walks you through the creation of the queue class that extends the "Queue" interface already built into Laravel (and what methods it requires). It then mentions the custom connector class it'll require and the service provider to link it all together. There's also a section covering the configuration you'll need to define the queue properties and what changes you'll need to make.

tagged: tutorial custom queue driver laravel interface configuration serviceprovider

Link: https://dotdev.co/creating-a-custom-queue-driver-for-laravel-3ec6463fa881#.grumknpj8

Freek Van der Herten:
Speed up a Laravel app by caching the entire response
Jul 20, 2015 @ 13:12:55

Freek Van der Herten has written up a tutorial for his site showing the Laravel users out there how to cache their entire response to speed up the overall performance of their application.

A typical request on an dynamic PHP site can do a lot of things. It’s highly likely that a bunch database queries are performed. On complex pages executing those queries and hydrating them can slow a site down. The response time can be improved by caching the entire response. The idea is that when a user visits a certain page the app stores the rendered page.

With a little help from his package it's easy to enable. Just install the package, add the service provider and you're ready to go. All successful responses will be cached unless told otherwise and cache files will be written out to files by default. He does point out that caching like this, while handy and a nice "quick fix" shouldn't be used in place of proper application tuning methods though. He also links to two other external technologies that could be used for the same purpose: Varnish and Nginx's own cache handling.

tagged: laravel application response cache output serviceprovider package

Link: https://murze.be/2015/07/speed-up-a-laravel-app-by-caching-the-entire-response/

Imagine Easy Solutions Blog:
Testing Logging in Silex
Nov 12, 2014 @ 17:34:50

On the Imagine Easy Solutions blog Yitzchak Schaffer talks some about logging in Silex by making use of a MonologServiceProvider. You can find the end result of his setup in this GitHub repository.

Silex is a PHP microframework from the same family as Symfony. My shop, Imagine Easy Solutions, uses Silex for some of our most important applications. Modular setup is at the core of Silex’s game, by means of Service Providers. The MonologServiceProvider makes it easy to add highly configurable logging to your application. But how to test your logging? It turns out that this Service Provider includes a DebugHandler which you can use to make log entries available in array form.

He walks you through the integration of the service provider via a "debug handler" and configuring it in the setup method. He also includes an "assertLogEntry" method to evaluate the current logs and check to ensure an entry was made. Finally, he puts it to use via a "notOk" method.

tagged: test logging silex serviceprovider monolog tutorial

Link: http://dev.imagineeasy.com/post/102394035784/testing-logging-in-silex

NetTuts.com:
Laravel Unwrapped: Session, Auth and Cache
Mar 11, 2014 @ 16:57:10

On NetTuts.com today there's a new tutorial introducing you to the Laravel framework and how to use its session, authentication/authorization and caching systems.

One thing though that not a lot of programmers take advantage of is Laravel's component-based system. Since its conversion to composer-powered components, Laravel 4 has become a very modular system, similar to the verbosity of more mature frameworks like Symfony. [...] In this tutorial, we'll be diving into a group of these components, learning how they work, how they're used by the framework, and how we can extend their functionality.

First up is the session component that lets you store the data in various places (file, cookie, etc) and how service providers fit into this. Next up is the Auth component, showing how to use the service providers to hook into a custom auth handler for finding and validating user logins. Finally, there's the Cache component. He shows how to apply a service provider to configure it, passing the data off to a MongoDB database to be stored.

tagged: laravel tutorial session cache authentication serviceprovider framework

Link: http://code.tutsplus.com/tutorials/laravel-unwrapped-session-auth-and-cache--cms-19952

Christian Schaefer's Blog:
Using PHP Web Scraper Goutte in a Console Task in a Silex project
Oct 10, 2011 @ 13:26:24

In a recent post to his blog Christian Schaefer shows how to use the Goutte tool (a web scraper) to pull information from one site and use it in another Silex-powered one. His tutorial uses a custom service provider for the integration.

Since I discovered the free Facebook App hosting by heroku I keep wanting to make something useful out of it. So I thought about a small service app. Without going into details yet about its nature there was one immediate problem to be solved. How to get hold of the data? So I thought to scrape it off some website. I know this isn't very nice but unfortunately there is no feed I can use.. And how to best scrape a website? Use Goutte!

All you'll need is two things - the goutte.phar and Silex phar files. The code for the service provider is a simple registration of namespaces. With that integrated, it's as simple as making a client object and calling it with a URL.

tagged: silex goutte webscraping tutorial serviceprovider phar

Link:


Trending Topics: