News Feed
Sections




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

SitePoint PHP Blog:
CRUD (Create Read Update Delete) in a Laravel App
May 25, 2015 @ 09:49:11

The SitePoint PHP blog continues their series around the creation of a basic CRUD (create, read, update and delete) application with PHP. In this second part of the series they build on the simple application in the first part and enhance it with the remainder of the CRUD handling.

In the previous part, we've bootstrapped our Laravel CRUD application by creating the database, some controllers, basic routes and simple views. In this part, we'll wrap things up and implement proper CRUD.

He jumps right in and creates the controller action and view to take in new "Task" information. This includes the installation of the Illuminate HTML package and setup of the needed provider and facades. He shows how to create the Task model and hook the results of the request into it and make the new record. This includes some basic "required" validation too. He then shows how to read and display the list of current tasks as well as setting up the edit and delete actions for each task.

0 comments voice your opinion now!
tutorial crud application laravel series part2 model form view

Link: http://www.sitepoint.com/crud-create-read-update-delete-laravel-app/

NetTuts.com:
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.

0 comments voice your opinion now!
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

NetTuts.com:
Programming With Yii2 Timestamp Behavior
May 22, 2015 @ 09:47:33

NetTuts.com has posted the next part of their "Programming with Yii2" tutorial series today. This new tutorial in the series focuses on the use of the timestamp behavior to assign the current date to an object (like for create or update dates).

In this tutorial, we'll explore Timestamp Behaviors, which reduce the amount of code you need to write with each new model for the common operation of creating timestamps for inserts and updates. We'll also dive into the Yii2 source code, examining how a behavior is implemented.

He starts with a brief look at what behaviors are (a reminder for those that may have already read about the sluggable and blameable behaviors). He then gets into the Timestamp behavior specifically and how to apply it to the sample project's "Status" instances. He shows the updates needed for the behavior configuration and rules. He also looks inside the component at the code that makes it up and the "touch" method it provides.

0 comments voice your opinion now!
tutorial timestamp behavior yii2 framework series touch

Link: http://code.tutsplus.com/tutorials/programming-with-yii2-timestamp-behavior--cms-23329

SitePoint PHP Blog:
Bootstrapping a Laravel CRUD Project
May 21, 2015 @ 11:18:27

The SitePoint PHP blog has kicked off a new series about using the Laravel framework to create a basic CRUD application relatively easily.

In this tutorial, we're going to build and run a simple CRUD application from scratch using Laravel 5.

The target audience for the tutorial are those completely new to the world of Laravel so they start at the beginning. He walks you through the creation of a new Laravel project and the database setup and configuration. He goes through the creation of "resourceful routing" and using the Laravel "artisan" command line tool to generate the matching controller. From there he talks about views and Blade templating followed by the creation and execution of the needed database migrations. The tutorial wraps up with a look at the model system included with Laravel and how they fit in with the Eloquent ORM.

0 comments voice your opinion now!
bootstrap crud project laravel tutorial series part1 introduction

Link: http://www.sitepoint.com/bootstrapping-laravel-crud-project/

SitePoint PHP Blog:
Youtube Videos in PHP Categories, Search and Suggestions
May 20, 2015 @ 11:47:14

The SitePoint PHP blog continues their series showing how to integrate content from the YouTube API into your application with this new tutorial. It covers the use of categories, searching and suggestions.

In the first part, we introduced the Youtube API and built a small demo to list the most popular videos on Youtube. In this part, we will extend our application to have search functionality, and we'll also list the available categories on Youtube to let the user narrow down their area of interest.

He starts with with the updates you'll need to make to the routes and controllers for the "categories" functionality and the API call needed to popular the content. He updates the "videos" page to show the category information and integrate the category into the pagination. Next up is the search, allowing the users to find videos based on a search string. The search route/controller/view functionality is added as well. He ends the post talking about a way to extend the demo and advice to keep an eye on quotas and implementing cache.

0 comments voice your opinion now!
tutorial series part2 youtube api categories search suggestion

Link: http://www.sitepoint.com/youtube-videos-php-categories-search-suggestions/

NetTuts.com:
Programming With Yii2 Blameable Behaviors
May 20, 2015 @ 10:33:10

NetTuts.com has continued their series about programming with the Yii2 framework with this new tutorial talking about blamable behaviors. These behaviors can de defined similarly to a common concept in other languages/tools, mixins

In this tutorial, I'll guide you through another of Yii2's interesting behaviors: helping automate the common web development task of assigning created by and updated by user_ids across the models in your web app using DRY coding and Yii2 BlameableBehavior. We'll also create a log that records who updated the Status table for every change made.

In his example he shows the code needed to insert and update these two dates related to users of your system. He shows what kind of updates are needed to support it in your migrations and adding in the support for the BlameableBehavior in the models. He then modifies this example to not only log the latest person to modify a record but a history of IDs in a "status log" table.

0 comments voice your opinion now!
tutorial blameable behaviors programming series yii2 framework

Link: http://code.tutsplus.com/tutorials/programming-with-yii2-blameable-behaviors--cms-23287

Fred Muya:
Configuring Custom Logging in Laravel 5
May 20, 2015 @ 08:22:36

Fred Muya has posted a guide to his site today showing you how to configure custom logging in your Laravel 5 application. He replaces the default logging methods with an injected Monolog instance.

I recently started working on a Laravel 5 project, and I'd like to share how I set up my custom file logging. I pooled the information below from several sources (acknowledged at the bottom of the article).

He walks through each step you'll need to configure the logging:

  • Overriding the bootstrap ConfigureLogging class (including the code needed)
  • Updating your composer.json to change up the PSR-4 autoloading
  • Modifying the Kernel.php file to update the constructor for the bootstrap (both HTTP and Console)

With these changes in place you can then use the normal "Log" handling Laravel provides and the magic will all happen behind the scenes. He includes two examples of this, one with a simple log string and another with something a bit more complex (and the resulting log output).

0 comments voice your opinion now!
custom logging monolog laravel5 tutorial bootstrap configure

Link: https://blog.muya.co.ke/configure-custom-logging-in-laravel-5/

NetTuts.com:
Using Laravel 5's Authentication Facade
May 19, 2015 @ 11:26:34

The NetTuts.com site has a new tutorial posted today sharing more information about the authentication facade in Laravel 5 and how to use it to implement simple, custom authentication handling.

Authentication is a part of almost all the web applications you work with. It's really boring to keep repeating all the boilerplate code in every project. Well, the good news is Laravel 5 rids you of this boredom by providing a ready-to-use authentication facade. All you need to do is configure and customize the authentication service provider to your project's needs. In this quick tip, I am going to show you exactly how to do that.

It's a seven step process to get things up and running (it sounds like a lot but all the code is provided):

  • Setting Up the Environment
  • Setting Up the Migrations
  • Configuring the Registrar Service
  • Updating the User Model
  • Updating the View
  • Securing Your Routes
  • Modifying the Default Authentication Routes

Each step includes the code needed and a brief summary of what's happening and how it effects the overall authentication setup. He also ends the post with a brief mention of the "password reset" email functionality and where the content for that email is located.

0 comments voice your opinion now!
laravel5 authentication facade custom tutorial database

Link: http://code.tutsplus.com/tutorials/using-laravel-5s-authentication-facade--cms-23461

Simon Holywell:
Memoization or function cache
May 18, 2015 @ 11:09:17

Simon Holywell's latest post shares an interesting feature of PHP's static function handling that lets you cache the results of a function call to improve performance.

A little known feature of PHP's static keyword is that it allows for memoization or function caching. This is a process whereby a functions heavy lifting can be cached so that subsequent calls are faster. It is possible to store any value in a memoized way such as arrays or even objects. This is done without any external side effects - that is to say that the code calling the function will require no changes to support memoization.

He includes an example of this in action, showing the use of a "static" keyword on a variable over two function calls. He goes through and explains how it works and the flow of the simple function. He builds this up a bit and shows the same functionality in the handling (and parsing) of a JSON document. He then gets more into the "real world" usage of this kind of static handling, pointing out that it can be very useful for caching without the need for an external service (like memcache or redis). His final example shows the caching of a function call using the same method and dependent on the arguments provided.

0 comments voice your opinion now!
function cache static example tutorial memoization

Link: https://www.simonholywell.com/post/2015/05/memoization-or-function-cache/

SitePoint PHP Blog:
Displaying Youtube Videos in PHP
May 14, 2015 @ 11:49:41

The SitePoint PHP blog has a new post today showing you how to display YouTube videos inside your application as a part of this series. The series is using Laravel as a framework to create the application.

In this two-part article, we're going to learn how to work with version 3 of the Youtube API and we'll build a demo along the way. [...] We're going to build a demo that lets the user browse popular videos on Youtube, search for a video, browse videos by categories, and select a video to watch. I will be using Laravel 5 as my framework of choice, and Vagrant for my development environment.

The end result will show a set of video thumbnails related to the selected category. He walks you through the steps to get the application set up and running including the configuration of your Google API connection. He creates a login controller to allow users to log in with their Google credentials and the callback to handle the API response. From there he makes the YouTube service provider, the "video list" endpoint (and view) and a single video page with an embedded player.

0 comments voice your opinion now!
tutorial youtube api google integration laravel vagrant application

Link: http://www.sitepoint.com/displaying-youtube-videos-php/


Community Events

Don't see your event here?
Let us know!


example introduction install series podcast interview conference php7 symfony2 configure language library laravel performance opinion release framework community api application

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework