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

Scotch.io:
Full E-Commerce Integration of Snipcart with WordPress
Jun 17, 2016 @ 11:03:24

The Scotch.io site has a tutorial for the WordPress users out there needing an ecommerce solution and wanting to integrate it seamlessly into your site. They show you how to integrate Snipcart, part of a platform that handles a lot of the common ecommerce tasks for you.

Even though an exponential amount of online tools keep popping up, WordPress remains a domineering web behemoth. More than 25% of active sites run on the famous CMS. Quite a chunk of the whole world wide web.

[...] Many front-end developers I've met and talked to enjoy working with a lean, quick e-commerce solution like Snipcart. But, they also want to give more autonomy in familiar CMS to their merchant clients. Since many of them use WordPress, I thought I'd write this article to provide them with a useful resource.

The post then breaks the process down into a few different steps, each including code and screenshots as needed:

  • Installing the required plugins
  • Show products in the theme
  • Integrate Snipcart's shopping cart
  • Update inventory with webhooks
  • Add Snipcart data to WordPress admin
  • Quick edit of inventory

If you're interested in the full code required for the integration, you can see it over on this GitHub repository.

tagged: scotchio ecommerce solution snipcart wordpress tutorial integration

Link: https://scotch.io/tutorials/full-e-commerce-integration-of-snipcart-with-wordpress

Laravel News:
Laravel and Elasticsearch
Jun 16, 2016 @ 09:08:22

The Laravel News site has posted a quick guide for those wanting to use ElasticSearch along with their Laravel applications. The post lists several libraries and resources that can help you get started quickly.

Elasticsearch allows you to search & analyze data in real time. Even though it’s extremely powerful working with delta’s and querying data is not that simple.

If you are using Laravel here is a list of packages and tutorials to help you easily integrate this into your app.

The packages include Plastic and Spatie Searchindex while the tutorials cover things like installing ElasticSearch on Homestead and integrating it with your application.

tagged: laravel elasticsearch integration tutorial library package links

Link: https://laravel-news.com/2016/06/laravel-and-elasticsearch/

TutsPlus.com:
How to Create a Slack Interface for Your PHP Application
Apr 21, 2016 @ 10:12:04

On the TutsPlus.com site they've posted a tutorial helping you connect your PHP application with Slack allowing for both the sending of content to your Slack channel(s) but also responding to "slash" commands.

If you've been following the development of office communication tools in the past year or so, I'm sure you've heard plenty about Slack. [...] As developers, we are in a good position to jump on the trend and think about ways we can use Slack as a chat-based user interface for our applications.

That's why, in this tutorial, you will learn how to get started with integrating your PHP application to Slack, by making it post messages to a Slack channel and respond to slash commands.

They start with a "bare bones" setup that will get you up and running and sending messages to your Slack instance. Their example takes in a string and sends it along through a custom Slack application. They walk you through the steps to create this application on the Slack side and this example code to make the connection and send the message. The tutorial walks you through all of the provided code and helps you get your OAuth credentials in place to secure the connection.

With this basic functionality in place you can then build on top of it and define "slash" commands that request a URL. Their example "tells a joke" in the channel making the request.

tagged: tutorial slack integration api slash command introduction

Link: http://code.tutsplus.com/tutorials/how-to-create-a-slack-interface-for-your-php-application--cms-25269

NetTuts.com:
Kick-Start WordPress Development With Twig: Introduction
Apr 12, 2016 @ 09:14:01

On the NetTuts.com site they've posted the first part of a new series showing you how to combine WordPress and Twig to "kick-start" your development with this popular content management system.

A lot has been written about the future of WordPress, and many believe that it lacks a templating language, especially when platforms like Django, Ruby on Rails, Node.js, Laravel, and even Drupal possess one. Facts like "WordPress powers nearly 25% of the web" make it difficult to question its current PHP-based templating system. But as the modularity in code is still missing, one can ask when the core will have a templating engine.

The good news is right here! The Twig templating engine along with a plugin called Timber can help us write super-clean and modular code in WordPress.

They start with a brief introduction to Twig and a bit of history of where it came from. They also give some reasons of why you might want to use this popular templating engine (besides its popularity, of course). The tutorial then starts in talking about Timber and how it integrates with both WordPress and Twig to render the Twig templates. This first article is more of an introduction to this integration and doesn't contain much in the way of code examples. That will be coming soon in the following parts of the series, though.

tagged: wordpress twig integration tutorial series part1 timber

Link: http://code.tutsplus.com/articles/kick-start-wordpress-development-with-twig-introduction--cms-24781

Mohamed Said:
Building an API for 3rd party applications
Mar 30, 2016 @ 09:30:31

In this post to his site Mohamed Said shows you how to build an API that allows for easier integration with your content/functionality by 3rd party applications. This example uses the Laravel framework but the ideas could be applied in any framework.

APIs are cool, & laravel can handle all the coolness you may desire. Here we talk about building an API for third party applications and allowing them to communicate with your application on behalf of users.

He starts where any good project should: planning for what features need to be included and the flow of the request/response process. He then walks you through the whole process for setting up the API:

  • Updating the routes for the API request endpoints
  • Creating the new Auth and Home controllers
  • Setting up the migration for the "applications" table
  • Using the firebase/php-jwt library for authentication/authorization handling
  • Registering a token and validating it on the incoming request

He wraps up the post talking about user authentication via a simplified OAuth-ish process flow, making requests using the resulting token and logging the user out (expiring the token).

tagged: api tutorial laravel application integration jwt token authentication authorization

Link: http://themsaid.github.io/laravel-api-3rd-party-20160327/

BitExpert Blog:
Using Doctrine, ramsey/uuid-doctrine and willdurand/hateoas
Jan 13, 2016 @ 10:29:30

The BitExpert blog has a post sharing some of author Stephan Hochdörfer's experience in combining Doctrine and the ramsey/uuid-doctrine and willdurand/hateoas packages to create a system that follows the HATEOAS API documentation structure for his Doctrine-based objects.

Recently I experimented a bit with Doctrine ORM and the willdurand/Hateoas library to expose my Doctrine objects via an HATEOAS api which luckily is a fairly trivial thing to do. All you need to do is set up the Hateoas serializer and call the respective serialize() method passing your Doctrine object as well the serialization type.

He shares the code to make the integration work, pointing out that the ramsey/uuid-doctrine library makes masking the autoincrement database identifiers (their "id" column) with UUIDs easier. He shows how to integrate this Uuid data type into the Doctrine docblock configuration and how to use the HateoasBuilder to handle the serializer instance containing the Doctrine object/results.

tagged: doctrine uuiddoctrine hateoas api integration builder tutorial

Link: https://blog.bitexpert.de/blog/using-doctrine-ramsey-uuid-and-willdurand-hateoas/

SitePoint PHP Blog:
Introducing Bugsnag – the Last Error Monitor You’ll Need
Jan 05, 2016 @ 11:12:53

The SitePoint PHP blog there's a tutorial posted showing you how to integrate your application with Bugsnag, the "last error monitor you'll need". Bugsnag is an external service that provides you more insight into the errors in your application and statistics around them.

The pursuit of building an error-free application continues. But in the meanwhile, we need to monitor our application’s errors and take action quickly. Many companies have tried to solve this problem, and one of the best on the market right now is Bugsnag. [...] In this article, we’re going to discover Bugsnag and integrate it into an existing Laravel application. You can clone the demo app from Github to follow along.

The article walks you through the setup of the demo application (cloned from GitHub) and the creation of a Bugsnag account with a 30 day free trial. It then shows how to integrate the PHP notifier package into your application, though the sample application is Laravel-based so they show how to use this package in the examples. From there they show how to provide your credentials, set up the environment for the app (ex: production, development, etc) and methods for sending various messages types and content over to the service. The post then looks at the Bugsnag dashboard, giving a brief overview of how it looks and what features it includes.

tagged: bugsnag tutorial integration laravel error monitoring service thirdparty

Link: http://www.sitepoint.com/laravel-with-bugsnag-the-last-error-monitor-youll-need/

Lakion Blog:
TDD your API with Symfony and PHPUnit
Dec 31, 2015 @ 09:16:52

On the Lakion blog there's a post showing you how to use a simple test class/tool they've created to unit test your APIs with PHPUnit.

At Lakion we truly believe in TDD approach. We are convinced that rapid development can not be achieved without proper testing and SOLID code. We always start with defining our needs and writing scenarios, specifications or tests that reflect them. Thanks to this approach, we get exactly what we need and tests are protecting us from regressions. [...] We have come up with a very simple but useful PHPUnit test case for testing APIs. - ApiTestCase.

They start with a bit about the ApiTestCase library and some background on why they created it and some of the features it provides (and other libraries it includes). They then show an example of a simple project using the testing tool to make a request to an endpoint (POST) and check the response matches what's expected. According to the TDD approach, the test fails first then they go back and create the functionality behind to to make it all work.

tagged: tdd phpunit api testing unittest integration apitestcase library tool

Link: http://lakion.com/blog/tdd-your-api-with-symfony-and-phpunit

NetTuts:
Doctrine ORM and Laravel 5
Nov 19, 2015 @ 10:55:39

On the NetTuts site there's a tutorial posted helping you get familiar with Doctrine 2 (the ORM) and how to integrate it with a Laravel 5 application via a simple service provider.

As a PHP developer, you might have come across the term ORM. ORM is a way to work with databases in the same way you work with classes and objects. If you were to delve deeper into how web applications are designed and built, after doing some exploring in their ORM you would find two well-known patterns: Active Record and Data Mapper.

[...] With Data Mapper the in-memory objects needn’t know that there is even a database present. They need no SQL interface code or knowledge of the database schema. One such solution is Doctrine.

The tutorial walks you through some of the basic concepts in using the Doctrine 2 ORM including Entities and Repositories. Also included is how to pull it in via Composer and update your Laravel configuration to use this bridge library for integrating it into your current application. Code examples are included showing you how to build out an entity, repository and a validator class for a basic blog post.

tagged: introduction integration tutorial laravel orm doctrine2 entity repository validator

Link: http://code.tutsplus.com/tutorials/doctrine-orm-and-laravel-5--cms-24914

BitExpert Blog:
Prophiler PSR-7 Middleware
Oct 27, 2015 @ 10:42:54

On the BitExpert blog Stephan Hochdörfer shares a new tool, a PSR-7 compliant middleware, that allow easy integration with your current application of the Prophiler debugging/profiling tool.

Prophiler is a PHP Profiler & Developer Toolbar which is part of the Phalcon project but can also be used as a stand-alone component, kind of like the Symfony Web Debug Toolbar or Z-Ray. What I like about Prophiler is that on the one hand hand it is super easy to install and on the other hand offers a few nice adapters (e.g. PSR-3 logging or Doctrine integration) out-of-the-box.

The middleware is a simple Composer install away. He includes the code you'll need to make the Prophiler instance and how to hook in the middleware for use. His example uses the Zend Framework Stratigility structure but because it's a PSR-7 compliant package, it can integrate just as easily with any PSR-7 framework/library. He also includes a sample of running a request and mentions the automatic addition of the toolbar to the output.

tagged: prohpiler profiling psr7 middleware integration zendframework stratigility tutorial composer

Link: https://blog.bitexpert.de/blog/prophiler-psr-7-middleware/