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

Rob Allen:
The beginner's guide to contributing to a GitHub project
Sep 24, 2015 @ 12:08:10

If you've ever wanted to contribute to an open source project but didn't have any idea where to begin, Rob Allen has a few suggestions to help you get started. His guide is a bit more on the technical level than others that talk more about finding a project or community to be a part of, though.

This is a guide to contributing to an open source project that uses GitHub. It's mostly based on how I've seen Zend Framework, Slim Framework and joind.in operate. However, this is a general guide so check your project's README for specifics.

He walks you through a four step process to getting ready to contribute and make that first submission to the project of your choice:

  • Set up a working copy on your computer
  • Do some work
  • Create the PR (Pull Request)
  • Review by the maintainers

Naturally, some of this depends on the process that the project follows to take in new submissions, either from an issues list or just random buxfixes. It's a pretty standard GitHub-centric guide to follow though. He also recommends reading this article from Lorna Mitchell about code reviews and what the maintainers of most open source projects will look for in submissions.

tagged: beginner guide opensource github contribute project

Link: http://akrabat.com/the-beginners-guide-to-contributing-to-a-github-project/

Cees-Jan Kiewiet:
Github auth token on TravisCI
Sep 24, 2015 @ 11:42:01

In a post to his site Cees-Jan Kiewiet shows you how to get an authentication token from GitHub to use in your testing on the Travis-CI continuous integration service.

The composer cache greatly speeds up your composer part of the build by only going to Github for new downloads. When combined with test lowest, current, and highest possible on Travis you only reach out to Github for new versions. Most likely to happen during the highest possible set of builds, but also when you've updated composer.*. This normally isn't an issue unless you hit Github's rate limit. And since composer is running on a 'public' travis box with a 'public' IP address that has been use by many builds before it there is a very very high chance it already hit the 60 requests per hour limit.

[...] To counter this problem we have to set a Github authentication token as environment variable in Travis for each project. And update .travis.yml so the token is used by composer.

He walks you through the steps you'll need to get a token of your very own:

  • Go to the Settings section on your GitHub account
  • Generate a new Personal Access Token
  • Add the token to the Travis-CI account you're using for your builds
  • Update your .travis.yml configuration with the token information

Each step includes either a screenshot of where to go or the configuration example you'll need to use (like in the yml file).

tagged: github authentication token travisci ratelimit

Link: http://blog.wyrihaximus.net/2015/09/github-auth-token-on-travis/

BitExpert Blog:
Running pdepend on PHP7
Aug 18, 2015 @ 09:57:19

On the BitExpert blog there's a post that shows you how to use the pdepend tool on PHP7, an automated tool that shows you the "quality of your design in the terms of extensibility, reusability and maintainability".

Being a good citizen of the PHP community we do test out internal libs against the current PHP7 codebase. So far we had no issues but then at one day one of our Jenkins PHP7 jobs failed. After investigating a bit it turned out that the problem was not part of our codebase but part of of pdepend. The pdepend process died with the error message that "T_CHARACTER and T_BAD_CHARACTER are no longer defined" which is true. The error was already reported as an issue on Github.

Unfortunately, as the problem here is a change to the core PHP language itself, there's not much of a workaround other than to just not run those certain jobs. He outlines how they handle detecting the tests that have problems, but only when run on PHP7. This allows them to run all of the tests and allow the automated system do to its work. When/if the problem is fixed in pdepend, all that's needed is to remove this one check and they're good to go.

tagged: pdepend phpdepend php7 skip test version error github issue

Link: https://blog.bitexpert.de/blog/running-pdepend-on-php7/

Matt Stauffer:
Using Github authentication for login with Laravel Socialite
Jul 17, 2015 @ 10:17:25

In a tutorial posted to his site Matt Stauffer shows you how to integrate Laravel with GitHub's authentication to link a user's profile to your application, made possible through the Socialite package.

Laravel's Socialite package makes it simple to authenticate your users to Facebook, Twitter, Google, LinkedIn, GitHub and Bitbucket. You can authenticate them for the purpose of connecting their pre-existing user account to a third-party service, but you can also use it as your primary login mechanism, which we'll be talking about here. I'm working on a new little micro-SaaS that is purely dependent on GitHub in order to operate, so there's no reason to set up any user flow other than just GitHub.

He starts with just a bit of insight into the overall flow of an OAuth connection with an application (which this is) and the pieces involved. Next he helps you get Socalite installed and working with your Laravel application. With this in place he shows you how to create a simple GitHub application and configure your Laravel instance with the provided client ID/secret and redirect URL. He adds in some routes to handle the two page requests and the controller methods to process the input. He makes a simple "users" migration to hold user information and a model to match. Finally he shows the result, stepping through the authorization flow, complete with screenshots.

tagged: laravel github social authentication login socalite package tutorial

Link: https://mattstauffer.co/blog/using-github-authentication-for-login-with-laravel-socialite

SitePoint PHP Blog:
Popular Users per Language and Region with Silex and Github
Jun 18, 2015 @ 11:53:49

The SitePoint PHP blog has a new tutorial posted showing you how to use the data the GitHub API provides to find popular users, per language, in an area. His sample example is a simple Silex framework based application and uses the KNPLabs GitHub library to interface with the API.

The data you can get through the GitHub API V3 is mostly what you can see on the GitHub web interface, except you can use the data in your application to come to interesting conclusions. That is what we are going to do in this article. [...] Now, what if there was a web service in which we could specify a location and a language (e.g. PHP) and get a sorted list of contributors to open-source? [...] In our web service, we will have one endpoint (i.e. action, URL) that shows the most popular ten creators. The most popular creators are the people in a location who have the largest number of stargazers. For this, we will retrieve each person’s repositories and add up the number of times each one has been starred.

He steps you through getting a Homestead Improved VM up and running (via Vagrant) and a basic Silex application up and running inside. He then pulls in the KNPLabs GitHub library via Composer and sets up a new client in the default route (and grabs the public user data for a user). He then shows how to change it up and use the Search API and some special queries to locate users by a given location. He adds another class, a "StarGazerCalculator", that's given the users returned, filters out the forks in the list and calculates the total "stargazer" count for the user. He does the same with the "top creators" list and sets it up as a service provider, fetches the data and returns the results as a JSON document.

tagged: popular user language region github api silex tutorial

Link: http://www.sitepoint.com/popular-users-per-language-region-silex-github/

Deploy PHP Apps Easily with Laravel Forge
Jun 18, 2015 @ 08:27:04

The Scotch.io site has a new post that wants to help make your Laravel deployments on Forge a simple thing. Forge is a "frontend" to make deployment on the hosting platform of your choice simpler with features for configuring the server, application deployment and automation (like push to deploy).

Forge is an incredible tool in the family of Laravel products that helps developers focus on developing, not deploying and hosting. I personally use it when deploying Laravel applications and it does make life much easier. Many of the pain points of hosting are taken care of for you so you can get right back to developing. [...] We’ll be diving into how we can deploy a Laravel application to Forge using Digital Ocean and GitHub.

He starts with a brief introduction to how Forge works and cooperates with the Digital Ocean stack to create the server and deploy the application. He answers a few questions about "why should you use Forge" and then gets into the actual setup of the server. He walks you through:

  • Linking the project to a GitHub or BitBucket repository
  • Adding SSH keys to connect to use for connecting to the server
  • Creating a server

He also goes through some of the server management features Forge offers in its dashboard including monitoring services, server tools and basic site management controls. Once everything is set up, he shows how to deploy from the GitHub repository and how to use third-party integrations (like Slack or HipChat) and the use of environment variables.

tagged: tutorial deploy application laravel forge github digitalocean

Link: https://scotch.io/tutorials/deploy-php-apps-easily-with-laravel-forge

SitePoint PHP Blog:
Exploring Github’s Public Events with PHP and Google BigQuery
Jun 15, 2015 @ 13:10:14

The SitePoint PHP blog has a new tutorial posted showing you how to explore GitHubs public events through the GitHub API and handled via the Google BigQuery infrastructure taking the burden off your own systems.

If you’ve been following along with my previous articles about Github’s API, you know that Github’s developers are doing their best to ease the pain of interacting with Github data. In this article, we’re going to take a look at the Github public events API and we will build a small demo along the way.

They start off with a brief introduction to both GiHub events (like pushes, merges, etc) and the BigQuery system and the problem it solves. They use a stock Laravel framework-based application (on a Homestead Improved VM) and add in the Google API credentials and a BigQueryServiceProvider using Google's own client to make the connection. They also set up a middleware authentication mechanism to redirect the user if they're not authenticated. They then move over to the BigQuery side and show how to use it's web-based console to perform queries and view results. They then translate this over to a simple "top ten" query, listing the top repositories ordered by number of forks. Building on this, they add in a simple form that allows the user to specify the language to search for (PHP, Javascript, etc) and outputs the results via a Blade template.

tagged: google bigquery github event api tutorial topten forks

Link: http://www.sitepoint.com/exploring-githubs-public-events-php-google-bigquery/

Christopher Pitt:
Making Dependable #2 (Series)
May 27, 2015 @ 09:25:01

Christopher Pitt has posted the second part of his series about creating "Dependable", a Laravel-based application with a focus on Composer use and customization. In part one he laid the foundation, creating a new project, database and setting up migrations to create the tables. In part two he builds on this and creates additional functionality to store a GitHub user's repositories.

One of the ideas we’ve had is to create an application; which can build a custom Composer dependency map, and deploy that to a new server. It would also be great if there was an interface for deciding which dependencies are included, and a unique URL for each installation.

He starts with a brief mention of testing and why he hasn't included that in his current work. Then he gets into the new models for storing repositories and the migration to create the matching table. He also includes the code that will be needed to link a Developer to a Repository. He finishes the post with an endpoint that can be called to refresh the data from GitHub and pull the repository information down and populate it into the database.

tagged: tutorial series part2 dependable laravel github repositories developer

Link: https://medium.com/laravel-5-tutorials/making-dependable-2-36411b64b958

E-mail List Alternatives With PHP: Using Mailgun's List API
May 25, 2015 @ 08:12:15

In a new tutorial posted to the NetTuts.com site they show you an alternative method for sending emails from your PHP application: using the Mailgun API. This API provides an interface into the Mailgun service, specifically made for sending emails without the hassles of hosting your own email server.

Over the past couple years I've run into various frustrations with both open source email list applications and paid cloud-based providers. In this tutorial, I'll guide you through my adoption of Mailgun.com, an economical solution I've been using successfully now for two years. [...] Mailgun is a cloud-based SaaS email cannon, like SendGrid. It's actually free for up to 10,000 emails per month. Mailgun is incredibly powerful and offers a well-documented API in a variety of popular languages. It provides for both send and receive capabilities, the latter of which can be quite difficult to develop from scratch. While Mailgun doesn't provide templates for rich HTML newsletters, it provides a platform upon which you can build anything.

He shows you how to use the service using a simple "ListApp" application (found on GitHub here) that provides some of the most common email list management functionality. He shows you how to set up a free Mailgun account and where to find their PHP SDK for the PHP integration. He then gets into the code examples, showing how to connect to the API via the SDK and doing tasks such as:

  • Creating and update a mailing list
  • Importing members to a list
  • Showing a list of current list subscribers
  • Send a new message
  • Synchronizing lists and members

He ends the post with a quick section about extending the ListApp application (or the PHP SDK) with a suggestion to add better error reporting or a queue system to manage the remote API requests more efficiently.

tagged: tutorial email list alternative mailgun api sdk listapp github

Link: http://code.tutsplus.com/tutorials/e-mail-list-alternatives-with-php-using-mailguns-list-api--cms-22824

Propser Otemuyiwa:
Developing a Micro-Service with Lumen
May 07, 2015 @ 09:55:57

Propser Otemuyiwa has a quick new post to his site showing you how to make a micro-service with Lumen, the recently introduced microframework from the creators of Laravel.

I introduced Lumen to you all in my previous post. Today we’ll be creating a simple microservice with Lumen. [...] So, the idea is to build a microservice that showcases your Developer Evangelist status based on the number of public repos you have on Github. The assumption here is that the more publicly available repos you have on github, the more you support the idea of Open source..giving back to the community.

He walks you through the full process:

  • Creating the Lumen project
  • Serving up the new application
  • Enabling Eloquent and the .env handling
  • Adding a single index route

He then fills in the route handling with a bit of code to pull from GitHub and get the number of public repositories a user has and assigns them a "rank" based on that.

tagged: microservice microframework lumen tutorial github example introduction project

Link: http://prosperotemuyiwa.com/developing-a-micro-service-with-lumen/