News Feed
Sections




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

Marc Aube:
Design Pattern Specification
May 25, 2015 @ 12:19:47

Marc Aube has a new post to his site that introduces you to the specification design pattern, a technique that's useful for ensuing the current state of an object is valid.

The specification pattern is a software design pattern used to codify business rules that state something about an object. These simple predicates determine if an object's state satisfies a certain business criteria. They can then be combined to form composite specifications using logical operators. Use a specification to encapsulate a business rule which does not belong inside entities or value objects, but is applied to them.

He suggests a few things the pattern could be useful for like validating the current state or define how an object should be created. He gives a few more "real world" examples and then gets into the code to create a custom specification. In his "CustomerIsPremium" spec he defines a single method on an interface to determine if the Customer given is correct. He then creates a class instance and encapsulates the logic inside its "isSatisfiedBy" method. He also includes a bit more complex example, showing how to create a composite specification for handling grouping like "and", "or" and "not" assertions. Finally he looks at how to build specifications that can be passed in and used as selection criteria. He does point out that this can leak database handling into the specification layer, however, and should really be avoided without a inversion of control method in place.

0 comments voice your opinion now!
specification designpattern pattern example composite select validate

Link: http://marcaube.ca/2015/05/specifications/

NoCapes Podcast:
Interview with Luke Stokes
May 25, 2015 @ 11:52:22

The NoCapes podcast has posted their latest episode, hosted by PHP community member Kayla Daniels. In this new episode she talks with Luke Stokes of FoxyCart.

In this episode of NoCapes, Luke Stokes discusses the journey towards hypermedia APIs, what is it and why hypermedia APIs are important.

You can watch this latest episode either on the NoCapes site or over on YouTube directly. If you enjoy the show you should subscribe to their mailing list and get more information as it's sent.

0 comments voice your opinion now!
nocapes podcast interview lukestokes api hypermedia foxycart

Link: https://www.youtube.com/watch?t=39&v=j43ZYS_wc8g

Mikkel Høgh:
Drupal is still a gated community
May 25, 2015 @ 10:16:42

In a recent post to his site Mikkel Høgh makes the suggestion that Drupal is still a gated community, mostly as it relates to the process around the "Project Applications" process.

One of the things the Drupal community prides itself on, is how open the community is. And that is generally true, but there's one exception. And that is the Kafkaesque horror-show we subject any newcomers that would like to publish their code on Drupal.org to. It goes by the name of "Project Applications". I know several people who've hit this wall when trying to contribute code. It's not uncommon to wait several months to get someone to review your code. And when it does happen, people are often rejected for tiny code style issues, like not ending their comments with a period or similar.

He talks about other factors involving reviews and delays that can also cause authors to abandon their work and feel "unwelcome and unappreciated". He mentions the "review bonus" system and how it's used to encourage participation (or "more hoops" as he puts it) from other authors. He notes that this situation mostly relates to those new to the tool and community and suggests that it just doesn't work (and really is unnecessary). He ends the post with a call to "end the madness" and move to a standardized role that would allow developers to publish without pushing people away and making them feel unwelcome.

0 comments voice your opinion now!
opinion drupal walledgarden project applications review delay contribution

Link: http://mikkel.hoegh.org/2015/05/14/drupal-is-still-a-gated-community/

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

Nate Krantz:
How I'm Writing Unit / Functional Tests
May 22, 2015 @ 10:50:42

In a recent post Nate Krantz has shared some of his own methods around writing functional and unit tests.

So...testing. That thing that everyone says is so important but you don't really learn about it in school. I've had some trials and tribulations with testing so I'm going to just dump out some thoughts here.

He starts with a bit of background on his own experiences in development and how he finally decided that testing would "solve everything". He started with unit tests (for a CodeIgniter application) and how he got them up and running. He talks about issues he found around dependencies (and static methods) and how he made use of mocks to reduce some of the issues with dynamic loading, at least how CodeIgniter does it. Unfortunately, this didn't work out as planned so he fell back to a test database and create more effective and simpler functional tests. Code examples are sprinkled through out the post to show how he was trying to solve the problem at different points in the process.

0 comments voice your opinion now!
unittest functionaltest opinion experience codeigniter

Link: http://www.natekrantz.com/why-test-driven-development-rocks-sucks/

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

Bigcommerce Engineering Blog:
PHP Memory Optimization
May 22, 2015 @ 08:18:12

On the Bigcommerce Engineering blog there's a new post sharing a few tips for memory optimization in your PHP applications. This includes tips you can implement at a code level without too many changes to the server or the need for external services.

Lately, I've been working on optimizing the memory of some of our backend PHP applications and wanted to share some of the tricks that I have come across, especially dealing with large set of data using PHP.

Each of their tips includes code to illustrate the technique:

  • Always cap your internal in-memory caching
  • Use layered caching
  • (Freeing) DB Resources
  • Free large blocks of memory

Some of the examples include output from the scripts showing the reduction (or non-growth) of the peak memory usage of the script.

0 comments voice your opinion now!
memory optimization tips caching resources free

Link: http://bigeng.io/post/119546277718/php-memory-optimization


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/


Community Events

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


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

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