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

Dac Chartrand:
Building a Simple API using Opulence PHP
Jan 30, 2017 @ 11:27:35

Dac Chartrand has written up a post to his site showing you how to create a simple REST API with Opulence, a PHP framework that bills itself as a "modern framework for modern PHP".

This tutorial will show you how to code a simple JSON API using Opulence PHP. We will install Opulence’s skeleton project using composer, then create a ‘user’ database entity, and finally we will match CRUD (Create, Read, Update, Delete) to POST, GET, PUT, and DELETE.

The start of the tutorial helps you get a new Opulence project set up and running including updating the configuration for content type handling and the database connection details. With that set up he moves into the code creating the "User" entity and its matching classes. He builds out the controller, selecting a REST controller from the options and builds out all methods needed for the CRUD user operations. The tutorial finishes with a bit of testing information so you can see the framework in action.

tagged: opulence api rest tutorial simple user framework

Link: http://kizu514.com/blog/building-a-simple-api-using-opulence-php/

Building Your Startup With PHP: Collecting and Managing User Reports and Feedback
Oct 11, 2016 @ 12:13:05

TutsPlus.com has posted the latest part of their "Building Your Startup with PHP" series following along with the creation of a "meeting planner" application based on the Yii2 framework. In this new article the focus is on collecting and managing user feedback and reports for a simple support system.

In this series, I'm guiding you through launching a startup from concept to reality using my Meeting Planner app as a real-life example. Every step along the way, I'll release the Meeting Planner code as open-source examples you can learn from. I'll also address startup-related business issues as they arise.

In this tutorial, I'm going to guide you through how I quickly and economically launched a support system and knowledge base for the application as well as some of the issues and alternatives I considered.

He starts with some of the third-party options he considered including Zendesk, Grove and Freshdesk. In the end he decided to go with the last option as it had the startup-friendly combination of a free account for small business and good functionality at that level. He covers their pricing levels, the signup process and the basic usage of the account and hooking it into Mailgun for sending/receiving emails. He also walks you through customizing the domain to match yours and updating the code to make the "Support" URLs match the new Freshdesk setup.

tagged: collect manage user feedback report startup tutorial series

Link: https://code.tutsplus.com/tutorials/building-your-startup-with-php-collecting-and-managing-user-reports-and-feedback--cms-23356

Freek Van der Herten:
Simplifying presenters in Laravel
Sep 20, 2016 @ 09:32:17

Freek Van der Herten has a quick post to his site with a tip about simplifying presenters in your Laravel based application. The "presenters" here are in relation to this package and how it helps with the output of the application.

In the Laravel template that we use to kickstart all our client projects at Spatie, I recently changed the way we handle presenters. Instead of using Jeffrey Way’s popular presenter package we now use simple traits. In this post I want to give some background on that change.

He gives a quick "crash course" on presenters for those not familiar with the concept and how it helps to keep view logic out of places like models and controllers. He briefly describes a presenter class that would return the "first name + last name" combination and what the code could look like. Then it's just a matter of using that trait (the class mentioned just before this) and a new magic property is defined to use in the view.

tagged: laravel presenter view logic property example user name

Link: https://murze.be/2016/09/simplifying-presenters-laravel/

How to Authenticate Users With Twitter OAuth 2.0
Apr 29, 2016 @ 11:21:10

On the TutsPlus.com site they've posted a tutorial showing you how to integrate with Twitter's OAuth authentication through a few simple steps allowing the well known "Log in with Twitter" functionality.

In this tutorial, you will learn how to use Twitter API 1.1 and OAuth 2.0 to authenticate users of your application and publish a test tweet.

To create services which act on behalf of users' accounts and make it really secure and easy to develop, we need three things: a Twitter application, the REST API and access to the user account To put the pieces together into a working mechanism, we need an authentication framework. As a Twitter standard, the REST API identifies Twitter applications and users using OAuth.

The tutorial starts with a brief description of OAuth for those that aren't overly familiar with the use of the technology and its flow. They then go through the steps you'll need to get your app working with Twitter's OAuth handling:

  • Create the Twitter application
  • Get the OAuth credentials (secret and key)
  • Installing a Twitter library via Composer
  • Configuring your app with the OAuth credentials
  • Building out the code to send the request to Twitter and receive the resulting callback

Once you receive that callback you'll have a token you can use to uniquely identify the user and interact with the Twitter API on their behalf. The post ends with some related links to other resources with more details about the Twitter API, their OAuth handling and other Twitter libraries.

tagged: twitter authenticate user oauth tutorial library flow

Link: http://code.tutsplus.com/tutorials/how-to-authenticate-users-with-twitter-oauth-20--cms-25713

Lorna Mitchell:
Simple Access Control for CakePHP3
Apr 11, 2016 @ 09:35:01

Lorna Mitchell has a post to her site with some helpful instructions for the CakePHP3 users out there around access control. The framework comes with no built-in functionality for authentication so she shows how to set up your own.

The newest version of CakePHP doesn't ship with built in ACL, which means you need to write your own. Personally I think this is a smart move, having looked at the one-size-fits-all solutions for previous versions of the framework and knowing that every system has different requirements, this version has good hooks and documentation on how to add something that works for your application. I thought I'd share what worked for mine.

She starts with some of the initial setup: creating the relationship between the users and her custom roles table and "baking" the controllers and templates. She then goes through the use of the authorize method and how it can handle the user/request combination to determine access. She includes the code for her auth class, showing both the authorize method and a simplified userHasRole method. She walks you through the code and one downfall the setup has: not being able to validate access in views and templates.

tagged: access control cakephp3 user loggedin authorization tutorial

Link: http://www.lornajane.net/posts/2016/simple-access-control-cakephp3

Matt Stauffer:
The auth scaffold in Laravel 5.2
Jan 11, 2016 @ 10:06:29

Matt Stauffer has continued his series about some of the new features in the latest release of the Laravel framework (v5.2) with this post looking at the new auth scaffolding it makes available.

If you're like me, many of the applications you build in Laravel have a similar Saas-type framework: user signup, user login, password reset, public sales page, logged-in dashboard, logout route, and a base Bootstrap style for when you're just getting started.

Laravel used to have a scaffold for this out of the box. It disappeared recently, to my great chagrin, but it's now back as an Artisan command: make:auth.

He talks about what all the scaffolding builds out including templates, routes and controllers. He provides examples of some of the generated code and what the output of these simple templates looks like (including a basic Bootstrap layout).

tagged: laravel framework auth scaffold tutorial example login user template controller route

Link: https://mattstauffer.co/blog/the-auth-scaffold-in-laravel-5-2

HHVM Blog:
Improved User Documentation
Dec 15, 2015 @ 09:05:32

The HHVM blog has a post today announcing some updates they've made around the documentation for the project and the release of the "next generation" of their documentation at http://docs.hhvm.com/.

Back in August, we announced that we are going full force in revamping user documentation. We sent out a public survey to gauge the standing on the existing documentation at the time. We had 160 responses to the survey. Those results served as both validation and a guide to our approach with the new documentation.

The survey showed some interesting results including that the existing documentation could use improvement, better content in certain sections and poor examples in some places. In order to help this they worked hard to revamp the documentation and created a new GitHub repository for the docs and allows developers to pull it down locally and contribute back content/corrections as they might catch them. They also lay out the new documentation structure, breaking it up into Hack, API and HHVM sections. Finally, they talk about the technology behind the site including the runnable code examples, how they're generated and what the build process looks like.

tagged: improved documentation user hhvm hack facebook api survey results

Link: http://hhvm.com/blog/10925/improved-user-documentation

Programming With Yii2: Using the Advanced Application Template
Nov 24, 2015 @ 10:10:47

NetTuts.com has continued their series around programming with the Yii2 framework in this latest tutorial looking at the use of the Advanced Application Template, an enhanced boilerplate system that provides a bit more built-in functionality than the default application setup.

In this Programming With Yii2 series, I'm guiding readers in use of the Yii2 Framework for PHP. As you begin to use Yii for real development, you may want to start your next project with its Advanced Application Template. Among other things, it provides integrated user management features as well as two applications, one for the consumer-facing front end and the other, an administrative back end.

In this tutorial, I'll introduce you to the Yii2 Advanced Template and guide you through the basic setup and usage.

They start with a look at how the Advanced Template is different from the default one (a checklist) and how to set up a new project using it. They show how to configure the database connection and execute the required migration to build out the user table. They also walk you through the Apache setup for local development and what the resulting "Congratulations" page should look like. The remainder of the post explores the user management section, showing how to configure email delivery, signup, login and password reset requests.

tagged: yii2 framework series advanced application template user management tutorial

Link: http://code.tutsplus.com/tutorials/programming-with-yii2-using-the-advanced-application-template--cms-24994

SitePoint PHP Blog:
Basic User Management in Symfony2 with FOSUserBundle
Nov 17, 2015 @ 12:44:05

The SitePoint PHP blog has a tutorial posted looking to help you with managing your application's users via the Symfony2 FOSUserBundle. This bundle provides much of the basic user functionality (creation, login, etc) is a easy-to-drop-in package for your Symfony 2 application.

Symfony has a very powerful authentication and authorization system, which can cater to a lot of our needs out of the box. FOSUserBundle is a library built on top of Symfony’s security system, which provides functionality such as registration, login, password resets, etc. It has built in support for MongoDB, as well as ORMs such as Doctrine, Propel, etc.

The tutorial walks you through the setup of a new Symfony 2 application (living on a Homestead instance) and grabbing the FOSUserBundle code via Composer and pulling into the project. They help you configure the application's security via the security.yml file and create the base user class and matching database table. From there they talk about customizing the templates that come as defaults with the bundle (Twig) and how to handle the email verification of new accounts as well as user logins/forgot password features. The tutorial ends with an example template showing the user's profile information including username, email address and and "edit" link.

tagged: tutorial user management fosuserbundle symfony2 authentication

Link: http://www.sitepoint.com/basic-user-management-in-symfony2-with-fosuserbundle/

Getting Started with Building APIs in Symfony2
Nov 09, 2015 @ 13:44:28

The IntelligentBee.com site has a "quickstart" kind of tutorial for those wanting to use Symfony 2 to build an API-based application. In this tutorial they walk you through a few step process to create the application and a few actions to get the basics working.

Hello all you Interwebs friends! While we’re passing through the shallow mists of time, REST is becoming more and more of a universal standard when building web applications. That said, here’s a very brief tutorial on how to get started with building APIs in Symfony2.

They make use of two other libraries, the FoSUserBundle, JMSSerializerBundle and Doctrine, to handle some of the low level user management and database functionality. They show you how to:

  • Generate a new bundle
  • Set up API versioning
  • Install the FoSUserBundle and JMSSerializerBundle
  • Configure the application's REST interface
  • Set up the routing to get things to the right place

Code is also included to show the creation of "get user" and "get users" actions along with a simple form and "add user" endpoints to allow new users to register. Wrapping the post up, he includes the code for the other pieces of the CRUD operations, the "edit user" and "delete user" methods.

tagged: api symfony2 tutorial introduction rest user management bundle versioning

Link: http://intelligentbee.com/blog/2015/11/03/getting-started-with-building-apis-in-symfony2/