Laravel News: How to use WordPress as a backend for a Laravel Application

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. Using PHP CodeSniffer With WordPress: Installing and Using PHP CodeSniffer

The site has posted the next part of their series showing the use of the PHP CodeSniffer tool with WordPress. In the first part of the series they introduced "code smells" and build on that in part two with the installation and use of PHP CodeSniffer to detect these smells.

In the first article of this series, we defined code smells and looked at a few examples of what they are and how we may refactor them so the quality of the code is improved.

[…] Ultimately, we’re working towards implementing WordPress-specific code sniffing rules, but before we do that it’s important to familiarize yourself with PHP CodeSniffer. In this article, we’re going to take a look at what PHP CodeSniffer is, how to install it, how to run it against an example script, and how to refactor said script. Then we’ll look at how we’re going to move forward into WordPress-specific code.

The tutorial then shows you how to get the tool installed using Composer, not the PEAR method. They help you install Composer then create the simple project with a composer.json configuration file defining the dependency. They provide a sample bit of code to run the analysis against and an example of the output showing violations of the coding standard.

SitePoint PHP Blog: WP API and OAuth – Using WordPress without WordPress

The SitePoint PHP blog has posted a tutorial showing you how to „use WordPress without WordPress“ via a basic RESTish API installed via plugin. The article focuses on using the OAuth authentication method to connect a client to the WP instance, linked to a system user via generated tokens.

In this tutorial, we’ll learn how to install and use WP-API with OAuth – a WordPress plugin which uses REST-like API endpoints to allow reading of WP content to unauthenticated users, and writing of WP content to users who authenticate via OAuth (or via Cookies for themes and plugins). Using the plugin isn’t very straightforward, and the prerequisite list is quite long, so this post was written to make it simple and relatively approachable (as long as you’re in control of your own server).

The tutorial walks you through the steps to get a WordPress instance installed (via a git clone) and setting it up to work with Homestead Improved. He then installs the „wp-cli“ tool to get the OAuth1 plugin needed to make things work correctly and how to use it to generate the needed key and secret for the OAuth connection. He then makes a simple script that uses the Guzzle HTTP client and it’s OAuth handling to make the OAuth request for a token, call the callback page and return the bearer token for the remainder of the requests. Finally he creates a simple page that uses this token to submit a new article via the API and views it in the WordPress interface.


Symfony Finland: Serving PHP on HTTP/2 with H2O and HHVM (Symfony, WordPress, Drupal…)

On the Symfony Finland blog there’s a new post showing you how to serve PHP over HTTP/2 with HHVM and H2O. H2O describes itself as a „new generation HTTP server providing quicker response to users when compared to older generation of web servers“.

This article is not about improvements made in HTTP/2 – as there are plenty of locations for you to read up on the internals. It’s a hands on article to get started using HTTP/2 today with popular tools such as Symfony, WordPress and Drupal with the HHVM PHP runtime from Facebook. You can just as well use PHP-FPM.

They start with a bit of a look at the current state of PHP and HTTP/2 on the various major web server types. H2O, while younger, natively supports HTTP/2, he does offer the caveat that „waiting won’t kill you“. Despite this, they go on to show you how to set up the PHP+H2O+HHVM combination complete with configuration examples and what to look for in the logs to ensure HTTP/2 functionality.

Link: Bereitstellen von WordPress mit Capistrano

In diesem letzten Beitrag zu sie haben einen Leitfaden für den Einsatz Ihrer WordPress Website (oder wirklich jede Art von PHP-driven Website) mit Capistrano . Es gibt einige WordPress bestimmte Bits in da, aber es ist eine gute allgemeine Leitfaden zur Implementierung mit diesem handlichen Werkzeug.

Ich bin kein Experte Capistrano (noch) und in diesem Beitrag werde ich versuchen, Ihnen einen Überblick, wie Sie es einrichten und wie Sie WordPress-Anwendungen (Websites) in Sekunden einsetzen. Wir werden mit nur einem Server heute, aber die Prinzipien bei der Bereitstellung von zwei oder mehr Arbeit sind so ziemlich das gleiche.

Er beginnt mit der Einführung Capistrano und sprach über einige der wichtigsten Vorteile, die es Ihnen und Ihrem Projekt einbringen können (vor allem – einfache Installationen). Das Tutorial hilft Ihnen, installieren Capistrano und bekommen es einzurichten, um mit Ihrem Github Repository arbeiten, um die Quelle zu ziehen. Die WordPress bestimmtes Bit hat mit Konfigurationsdateien zu tun und schlägt eine „if“ überprüfen, ob es die lokale Konfigurationsdatei zuerst. Ebenfalls enthalten sind die Updates müssen Sie den Capistrano config-Datei und die Befehle zu machen, um die neuesten sowie Rollback zur vorherigen Version schieben werde.

DevShed: Integrieren Facebook Comments Code mit WordPress oder PHP

Auf DevShed heute gibt es ein neues Tutorial zeigt Ihnen, wie Sie integrieren Facebook kommentieren mit Ihren PHP-Anwendung über das Facebook Connect API.

Facebook Kommentare sind eine großartige Möglichkeit, Ihre Website für Social Media Optimierung und fügen Sie eine Ebene der Benutzer-Engagement zu Ihnen vor Ort. Quality Website Kommentare kann Ihre Website die Glaubwürdigkeit sowie ihre Verkehrs. Dieses Tutorial soll Ihnen beibringen, wie man Facebook-API verwenden Connect Kommentar Boxen auf Ihrer Webseite integrieren in ein paar einfachen Schritten, die Verwendung eines kleinen PHP und einige Winkelstückfett.

Du wirst zu eine Anwendung festlegen müssen für Ihre PHP-Anwendung, um die Verbindung herzustellen. Dies gibt Ihnen die einzigartige Schlüssel für Ihre Anwendung, die beim Aufbau der Kommentierung verwendet werde. Durch die Einbindung eines Facebook Javascript-Datei, ist alles, was Sie tun müssen, Ausgabe ein spezielles „fb“ HTML-Tag mit der richtigen Attribute und ein Meta-Tag oder zwei, es mit Ihrer Anwendung Tasten konfigurieren.