News Feed
Jobs Feed
Sections




News Archive
feed this:

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

SitePoint Web Blog:
Is Ghost Really a WordPress Killer?
November 13, 2013 @ 11:19:32

The WordPress platform has become one of the de-facto standards when it comes to blogging and content management sites. In this new post, though, SitePoint wonders if a new competitor in the market is enough to unseat WordPress from its high ranking - Ghost.

When someone mentions the term blogging platform your mind likely brings up thoughts of WordPress, or maybe Blogger.com. It did, didn't it? While those two platforms have clearly carved out a respectable slice of the world's blogging population, there remains a void left unfilled. This gap in platforms was largely created by the incredible popularity and growth of the blogging world itself. [...] This new entrant goes by the stealthy moniker Ghost. A fitting name really, given it's unapologetic focus on no­frills web publishing.

They go through this new tool, spotlighting some of the features it offers and the extensibility it offers (complete with screenshots). While Ghost is a Node application (unlike its PHP counterpart) it's still relatively easy to get up and running. They do admit, however, that the title of the article is a bit inflammatory. Ghost and WordPress have different target audiences and widely different feature sets, but in the blogging realm, Ghost provides an interesting alternative.

0 comments voice your opinion now!
ghost wordpress blog overview tour simple

Link: http://www.sitepoint.com/ghost-really-wordpress-killer/

Rasmus Larsson:
Building a template engine in PHP
May 31, 2013 @ 11:11:27

Rasmus Larsson has a recent post to his site showing how to build a basic templating engine in PHP that uses the "__toString" to help render the result.

Possibly the most common sign of bad code is tight coupling, especially between logic and presentation. It might seem like a good idea to print out the HTML while the data is being generated, but it more often than not leads to a big incoherent mess of tangled code. [...] While PHP makes it unnecessarily easy to write shitty code it also provides a lot of ways to avoid it. I'll use this post to show you how ridiculously easy it is to create a template engine in PHP in three easy steps.

He includes the sample code for a "Template" class and shows the combination of exporting variables and output buffering to return the resulting template populated with values. The "__toString" method makes it so that you can just echo out the object and get the results.

0 comments voice your opinion now!
template engine tutorial simple tostring view

Link: http://www.rasmuslarsson.se/2013/05/a-template-engine-in-php

Lorna Mitchell:
Simplest PHP Generator Example
May 23, 2013 @ 10:31:02

On her blog Lorna Mitchell has posted an example of a basic generator written in PHP, a feature of the upcoming PHP version 5.5.

I really like the generators feature that's arriving in PHP 5.5, and since we're now into release candidate releases, it's actually not that far away. I've been speaking on this topic and I thought I'd share my trivially simple code example from my slides.

She includes an example of a very basic generator using the new "yield" keyword and how to implement it in a simple foreach loop. There's also a little talk about when is a good time to use generators in your applications (two examples: complex number calculation and working with large data sets a chunk at a time). For more information on how these generators will work, check out this page in the PHP manual.

0 comments voice your opinion now!
generator simple example introduction manual

Link: http://www.lornajane.net/posts/2013/simplest-php-generator-example

Rob Allen:
Simple logging of ZF2 exceptions
April 25, 2013 @ 10:31:40

In this new post to his site Rob Allen shows you how to implement a simple logging method for catching exceptions in your Zend Framework 2 application.

I recently had a problem with a ZF2 based website where users were reporting seeing the error page displayed, but I couldn't reproduce in testing. To find this problem I decided to log every exception to a file so I could then go back and work out what was happening. In a standard ZF2 application, the easiest way to do this is to add a listener to the 'dispatch.error' event and log using ZendLog.

He uses an event listener to attach a service that contains a "logException" method. This method uses the ZendLog component to write out the error message to a local log file including a backtrace of where the issue occurred.

0 comments voice your opinion now!
simple logging exception handling service event listener tutorial

Link: http://akrabat.com/zend-framework-2/simple-logging-of-zf2-exceptions

Vance Lucas:
Valitron The Simple Validation Library That Doesn't Suck
March 05, 2013 @ 11:43:24

Vance Lucas has created a "validation library that dosen't suck" and posted about it to his site - his Valitron library.

Valitron is a simple, minimal and elegant stand-alone PHP validation library with NO dependencies. Valitron uses simple, straightforward validation methods with a focus on readable and concise syntax.

He created the library because of frustration with other tools that had (sometimes major) dependencies on other packages. All he wanted was something lightweight and easy to use that was flexible about how it handled its validation rules. Valitron lets you apply a validation (like "required") against multiple fields in the provided data and includes checks for things like length, valid IP, active URL, alpha-numeric, date format and regular expression match. You can also add custom validation rules via a callback/closure.

0 comments voice your opinion now!
validation library valitron simple dependencies


Anthony Ferrara:
Designing An API Simplified Password Hashing
November 19, 2012 @ 12:42:22

A while back Anthony Ferrara proposed a standardized password hashing feature to be included into the core of PHP. It was voted on and it was decided it would be introduced in the PHP 5.5 releases. Anthony has written up a new post talking some about his process in making this upcoming feature and answering some of the most common questions he's gotten about it.

The other day, PHP 5.5 Alpha 1 was released to the public for the first round of testing the new features that are coming out. One of those new features is the Simplified Password Hashing API that I proposed (and was accepted). I have received a lot of feedback and criticism of the new API in the months since it's been committed. I figured now that Alpha 1 is out and people can play with it, I should respond to some of those items, and give a little bit more insight into why it was built the way it was...

He talks about some of his goals with the use of the functionality (simplicity, something "the 99%" can use) ans answers questions about:

  • Why the functions aren't namespaced
  • Why it's not just a class that can be included when needed
  • The choice of not going with an OOP interface
  • Why PBKDF2 and Crypt-SHA-512 aren't supported

...and several other questions, but you'll have to read the full post for the rest of those. You can find out a lot about the API for this functionality from its wiki page and, if you'd like to try it out (in an alpha state), you can download this version of PHP and compile it yourself.

0 comments voice your opinion now!
api design questions password hashing simple alpha


Chris Hartjes' Blog:
Simple API Testing Using Behat
February 27, 2012 @ 10:09:18

Chris Hartjes has taken some of his first steps to testing a web service with the help of the Behat BDD testing framework. In this new post he shares some of that knowledge and a bit of code to help guide you if you'd like to get started yourself.

I have been trying to push my JavaScript skills lately by first playing around with Node.js to get a feel for event-driven server-side coding and by trying to build something semi-useful using Knockout. [...] After working with PHPUnit's "assert that the result matches expectations" philosophy, switching to using a behavioural approach has changed how I decide to approach actually testing something.

He shows how to define a "scenario" in a more recognizable sort of English. His example is testing a web service to ensure of a few things:

  • the response is JSON
  • it contains at least one transaction
  • the first transaction has an ID, contains two teams and has a description

Included in the post is the resulting Behat test code (generated and modified with his testing details) and an example of the execution of the test.

I think that the BDD approach maps better to a results-oriented methodology when it comes to testing: you are using real-life scenarios to make sure that you are getting back the results you are expecting. In the end. that is still the goal of testing.
0 comments voice your opinion now!
simple api test behaviordriven behat example slim framework


PHPMaster.com:
WordPress Plugin Development
February 20, 2012 @ 10:50:39

On PHPMaster.com today there's a new tutorial showing how you can create a custom WordPress plugin for the popular PHP-based blogging/CMS tool.

If you've ever used WordPress to build a site quickly, chances are you've used one of the many plugins that are offered to extend the functionality of this popular blogging software. Plugins are one of the many things that make WordPress so attractive. [...] There are times, however, when you can't quite find what you need from existing plugins. This article will show you how to create your own WordPress plugins by walking you through an example to display some text using a widget in a the sidebar.

He walks you through all of the steps you'll need to create the plugin - making the main plugin file (definition) and using some of the methods available to create the functionality: update, form, widget and the constructor to set it all up.

0 comments voice your opinion now!
wordpress plugin development introduction simple text form


Dave Marshall's Blog:
Phpmig - Simple migrations for php
November 01, 2011 @ 13:19:02

In a new post to his blog Dave Marshall shares a homegrown migration tool he's created to help make database migrations a simpler task - phpmig.

I've previously blogged about migrations with phing and dbdeploy and also porting ActiveRecord::Migrations to PHP, now here I am again blogging about yet another way of doing migrations in PHP projects. Only maybe this time it's different, maybe this time I've found a way I'm happy with...? Phpmig is a simple migrations system that was written to be easily adopted regardless of the framework or libraries you are using. It requires a little bit of setting up, but if you know you should be using migrations, you're probably more than capable.

He's worked up a sample application to show you how to get things set up and working - a basic Silex-based application. Phpmig is used to create a basic bootstrap for the deployment that includes the use of Pimple for dependency injection and a command-line interface to generate a migration skeleton class for the up/down methods. The source for phpmig can be found on github.

0 comments voice your opinion now!
migration database simple phpmig custom


Developer Drive:
Create Your Own CRUD App with MySQL and PHP
November 01, 2011 @ 08:06:52

On the Developer Drive blog today there's a new tutorial helping you build out a simple CRUD (create, read, update and delete) system using a MySQL backend. This is just the first part of the series, introducing you to some concepts and getting the ball rolling connecting PHP and the database.

You're may be wondering what exactly CRUD is. CRUD simply stands for Create, Read, Update and Delete and it is the one of the fundamental principles of programming logic that can be expanded and applied to larger projects. For example, let's imagine we're creating a social network and we like to have the ability for users to create accounts, edit and update information for those accounts and also delete said accounts; that is CRUD at work.

This first part covers the structure of the database that'll make up the storage and includes a brief snippet of code to connect your PHP to the database (using PDO).

0 comments voice your opinion now!
crud database mysql tutorial application simple introduction



Community Events











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


framework code install component introduction security series package facebook hhvm release podcast symfony2 application threedevsandamaybe hack unittest composer opinion language

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