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

Laravel News:
How to use WordPress as a backend for a Laravel Application
Aug 17, 2016 @ 12:51:08

The Laravel News site has posted an interesting tutorial where they describe the use of WordPress as a backend for a Laravel application. This setup is based on the Laravel News' own experience with it in the recent refactoring of the site.

Last week I relaunched Laravel News, and the new site is running on Laravel with WordPress as the backend. I’ve been using WordPress for the past two years, and I’ve grown to enjoy the features that it provides. The publishing experience, the media manager, the mobile app, and Jetpack for tracking stats.

I wasn’t ready to give these features up, and I didn’t have the time to build my own system, so I decided to keep WordPress and just use an API plugin to pull all the content I needed out, then store it in my Laravel application. In this tutorial, I wanted to outline how I set it all up.

While he did find other methods for linking the two, they didn't quite fit with what he wanted so he worked up his own. The content is then synced via a recurring task pulling over posts, categories and tags. He gets into the WordPress REST API first, showing the extraction of the posts from the API and pushing them into a Laravel collection. There's also an example of how to sync a post with the database (API) and how to create a new post in a similar way. Also included is the code to get the featured image, get the category for a post and sync the tag values. The tutorial finishes with the code for the sync command and pushing it into the scheduler.

tagged: wordpress backend laravel application tutorial rest api

Link: https://laravel-news.com/2016/08/wordpress-api-with-laravel/

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/

Symfony Finland:
Universal Rendering in PHP/Twig could be done with the Angular 2 Template Compiler
May 09, 2016 @ 11:15:01

The Symfony Finland site has a post about Angular 2, its server-side rendering support and how Symfony can fit into the picture.

At the ng-conf event in May 2016 there were sessions discussing how Angular 2 can support server side rendering in various platforms. If you're working on a project running on Node.js, then Angular 2 is a native citizen. For other options like ASP, Java and PHP there are a few options on the table.

[...] Later during the ng-conf more details on the Server Side Rendering (Universal Rendering in Angular lingo) can be implemented in different environments to improve first page load experience. [...] The downside of these approaches is that you need to add additional complexity either by adding a dependency to an external service or require a rather exotic PHP extension at this point.

Instead he suggests using Twig along with the Angular 2 template compiler and some custom extensions to the base templating to format the output as Angular is expecting it. He talks about how the current backend rendering of templates could easily be translated to this handling. He also suggests that even just partial server-side rendering might be enough to help with the performance of the application.

tagged: symfony universalrendering angular2 twig template backend frontend performance

Link: https://www.symfony.fi/entry/universal-rendering-in-php-twig-with-angular-2-template-compiler

Three Devs & A Maybe:
Episode 76 - Let's TalkTalk about Security
Oct 30, 2015 @ 09:23:55

On the latest episode of the Three Devs and a Maybe podcast hosts Michael Budd, Fraser Hart, Lewis Cains and Edd Mann talk about security in web applications, both on the client and server side.

This week we are very lucky to have Lewis back on the show after his recent move. We discuss what he has been getting up to in his absence and how he is balancing work/life whilst being remote. Following this, we touch upon a reinvigorated passion for software architecture, moving to a framework from bespoke solutions and the middleware pattern. Discussion then turns towards moving from AngularJS to React/Flux and resources Edd has written and found useful whilst learning the subject. Security is the next hot-topic with the recent TalkTalk security breach in question, an interesting pseudo-random number seed issue and SSL/TLS/HTTPS all explained. Finally, we conclude with an update on Mick’s final year project and his work with decision trees.

You can listen to this latest episode either through the in-page audio player or by downloading the mp3. If you enjoy it, be sure to subscribe to their feed to get updates when the latest episodes are released.

tagged: threedevsandamaybe podcast ep76 security frontend backend

Link: http://threedevsandamaybe.com/lets-talktalk-about-security/

Master Zend Framework:
Using Sessions In Zend Framework 2 - Part 2
May 06, 2014 @ 11:18:26

The Master Zend Framework continues its series about using sessions in Zend Framework 2 applications. In part two of the series he focuses on validators and some of the backend storage options the framework makes possible.

In last week’s tutorial we covered the basics of sessions in Zend Framework 2, looking at how to implement them by making changes to module/Application/Module.php so that they’re available application-wide then how to both set and retrieve information in the session. In this week’s tutorial, we’re going to take last week’s post further, by looking at session validation as well as different backends. These two things will help protect your session data from session hijacking, as well as help you scale your application, by storing the information using a more universal backend, which a filesystem most often times will never be.

He starts off with a bit of background about the structure of an average session in the framework is like, broken out into sections via the "Container" object. Then he starts in on the validators and describes a two of the built-in methods: "HttpUserAgent" and "RemoteAddr". A few code examples are included before he moves on to the backend options (like Cache, DbTable and MongoDB) using a "StorageFactory" object in the configuration.

tagged: session zendframework2 part2 series validate backend

Link: http://www.masterzendframework.com/sessions/using-sessions-zend-framework-2-part-2

SitePoint PHP Blog:
Dart and PHP: A Legacy Animal Guess Game
Dec 10, 2013 @ 11:54:40

The SitePoint PHP Blog has a new tutorial posted today showing an interesting combination of technologies to create a simple Animal Guesssing Game - using Dart as the frontend and PHP as the backend.

Back when I was learning programming on Apple II using BASIC, there was an Animal Guess Game. This game was a very primitive AI game: the computer tries to ask a few YES/NO questions and receives the answer from the user. Based on the answer, it may ask more Y/N questions until it tries to guess the animal. In this tutorial, we will learn how to re-vitalize this program using PHP as backend and Dart as frontend. Of course, a database will be used to store all the questions and guesses of animals.

He walks you through the database setup (including table definitions) and provides some simple PDO-based code to connect and fetch results. Then comes the Dart frontend. He goes through the installation and configuration and how to make a new Polymer application, also including the markup and Dart code to make the backend connection.

tagged: dart animal guess game backend frontend tutorial

Link: http://www.sitepoint.com/dart-php-legacy-animal-guess-game

Greg Freeman:
Your PHP Framework Choice doesn’t Matter
Aug 22, 2013 @ 11:45:18

In this new post Greg Freeman suggests something contrary to what most PHP developers (and framework supporters) believe - your choice of PHP frameworks doesn't matter...if you're basing it on speed.

I’m talking about the speed of PHP and more specifically, evaluating frameworks and tools based on “speed”. If you have been in the PHP developer community for more than a few months, you would have seen at least a few discussions about what the fastest PHP framework is, as if this were one of the first key metrics you should evaluate first when choosing a framework for your team. You may even be contemplating switching from your current framework because you heard of a new framework that is faster. In the rest of this article, I’m going to do my best to show you why this not the best line of thinking and provide alternate and in my opinion better metrics for evaluating tools.

He talks about "frontend" versus "backend" PHP developers and how most PHP devs fit into the first category, not knowing how their applications really execute on the backend. This includes a pretty high-level concept of "speed." For his examples, he sets up a WordPress instance and fills it with some dummy content. He illustrates how, with a bit of tweaking on the "backend" side of things (server, environment, etc) the performance of the application can be greatly varied. He includes the specs for the environment he ran the tests in, some of the things he changed and a summary of the results.

tagged: framework choice speed benchmark frontend backend environment

Link: http://www.gregfreeman.org/2013/your-php-framework-choice-doesnt-matter

NetTuts.com:
Building Ribbit in PHP
Jan 04, 2013 @ 10:22:48

In the first part of a new series on NetTuts.com, they started on the creation of a full web application (a Twitter clone). The first article covered the CSS and using LESS to create an interface. In this second post they get into the PHP backend, opting to create it without a framework on the first shot.

In the initial entry in this series, we took care of the UI-aspect of our Twitter-clone, called Ribbit. Now, we’ll begin coding the application in a number of languages. This lesson will leverage standard PHP (with homegrown MVC), but, in future articles, we’ll review other implementations, such as with Rails or Laravel.

They provide all the code you'll need, the database table structure to power it (MySQL) and the examples of a model, router and basic MVC stack to handle the requests. They help you make a user creation and login system as well as a few other pages ("buddies", "make a post" and a few others). You can also download the source from their Github account if you want it all in one shot.

tagged: ribbit backend tutorial series css less mvc

Link:

DZone.com:
Sencha Touch 2 Models - Loading And Saving Model Data Using a Proxy, PHP Example
Aug 31, 2012 @ 11:54:19

On DZone.com there's a new tutorial posted (by Jorge Ramon) about hooking together the models of Sencha's Touch 2 with a PHP backend to make saving data to them simpler via a proxy.

Sencha Touch models have the ability to work with a proxy. This feature allows you to save and retrieve model data from the server, memory or local storage, without depending on a Sencha Touch data store. Let’s try it with a very simple scenario where the server side is a PHP page.

The article includes both the Javascript to create the models (along with its proxy and custom API methods defined) as well as the PHP that powers the backend. The PHP just reads from the "php://input" stream and echoes back out JSON, but it gives you an idea of what to expect to receive. For more information on Sencha Touch, check out their documentation.

tagged: senchatouch2 model backend save proxy tutorial

Link:

PHPMaster.com:
Server-Side HTML Handling Using phpQuery
Jun 12, 2012 @ 10:58:26

PHPMaster.com has a new tutorial today showing how you can use phpQuery to work with HTML in your application. phpQuery is a server-side CSS-selector-driven based on jQuery's API.

Think about how you can change and manipulate the generated HTML using server-side PHP code. phpQuery is the ultimate solution that will come to your mind. If you haven’t heard about phpQuery, you may be interested in this article since I am going to give you a brief introduction to phpQuery and explain how you can use it in real-world projects.

The tutorial shows you how to generate a simple table with alternating row colors (zebra) and column headers from an array of product information. They also talk a bit about why using something server-side like this is important (over something client-side like jQuery) - how it can make things easier by keeping the "business logic" all in one place, leaving your frontend to do what it does best.

tagged: tutorial phpquery backend html processing

Link: