News Feed
Jobs Feed
Sections



Recent Jobs

News Archive
Leaseweb Labs Blog:
Migration to Symfony2 continued
February 09, 2012 @ 11:51:59

On the LeaseWeb Labs blog there's a continuation from a previous post about migrating your Symfony1 application over to Symfony2. In the first part of this series of posts, Stefan Koopmanschap talked about wrapping your code to make it work. In this second post, Maurtis van der Schee tackles two issues Stefan mentioned - performance problems and handling authorization/authentication.

On December 21, 2011 Stefan Koopmanschap wrote an excellent article on this blog titled "Painless (well, less painful) migration to Symfony2." [...] We were very much inspired by his passionate elucidation and we were fully convinced of the urge to start migrating to Symfony2 as soon as possible. However, he also provided us with a "A word of caution" about 2 things: performance and authentication/authorization. This might get some people worried, but not us: it challenged us to find a solution for those two open issues.

They explain why these two things are a problem and some of their solutions they've created - a .htaccess for routing and manually replicating the Symfony2 session in the Symfony1 code. Included in the post are the rewrite rules and code to make these two things happen (and a small configuration change to make them work).

0 comments voice your opinion now!
symfony2 migration wrapper authentication performance authorization



SitePoint.com:
How to Create Your Own Random Number Generator in PHP
February 09, 2012 @ 10:03:35

On SitePoint.com today there's a new tutorial showing how to create a random number generator in PHP (with the help of methods like mt_rand and mt_srand).

Computers cannot generate random numbers. A machine which works in ones and zeros is unable to magically invent its own stream of random data. However, computers can implement mathematical algorithms which produce pseudo-random numbers. They look like random numbers. They feel like random distributions. But they're fake; the same sequence of digits is generated if you run the algorithm twice.

Included in the post is code showing how to use the random functions and how to create a class (Random) that provides a few methods to help make generation easier - "seed" and "num". It first calls "seed" with a number to start the random generator off with and then "num" in a loop to pull out random values based on that.

0 comments voice your opinion now!
random number generator tutorial introduction mtrand


Refulz.com:
The __toString() Method - Objects as Strings
February 09, 2012 @ 09:27:19

On the Refulz.com blog there's a recent post introducing the __toString() magic method in PHP. This handy method allows you to define how to return an object when it's referenced as a string.

We started the study of PHP magic methods by learning about __get() magic method. [...] PHP is loosely typed language and same variable can be used or referred as string, number or object. The __toString() method is called when the code attempts to treat an object like a string. This function does not accept any arguments and should return a string.

Some quick code is included showing how it works - returning a combined string made from two private class properties when the object ($obj) is echoed out. They also show multiple ways of using the method in both pre- and post-PHP 5.2.

0 comments voice your opinion now!
tostring magic method object string


PHPMaster.com:
Using Traits in PHP 5.4
February 09, 2012 @ 08:40:50

On PHPMaster.com today there's a new tutorial about using a feature in the upcoming PHP release (5.4) to make it easier to work with more modular code - using traits.

In this article I will discuss traits, a new feature introduced in PHP 5.4 to overcome [issues where multiple inheritance is needed]. The concept of traits itself is nothing new to programming and is used in other languages like Scala and Perl. They allows us to horizontally reuse code across independent classes in different class hierarchies.

Included in the post is example code showing what the use of a trait looks like and a method for creating a Singleton that can spawn instances of two classes. Also included are examples of:

  • using multiple traits at once,
  • traits made up of traits,
  • the importance of order,
  • aliasing to avoid conflicts,
  • reflection
  • and a few other features that come along with their use.
0 comments voice your opinion now!
traits tutorial introduction feature multiple inheritance



Ibuildings techPortal:
DPC Radio Implementing OAuth
February 08, 2012 @ 14:20:29

On the Ibuildings techPortal today they've posted the latest in their DPC Radio series of podcasts as recorded at last year's Dutch PHP Conference. In this new episode they share Lorna Mitchell's talk "Implementing OAuth".

With Twitter moving its API to OAuth the idea of using tokens rather than passwords for authentication went mainstream. Many explanations of OAuth make it seem complicated whereas in reality the "OAuth Dance" is a series of simple steps executed in sequence. This talk covers consuming and providing OAuth services, includes implementation examples, and is recommended for all technical leads, architects, and integration specialists.

You can listen to this latest episode either via the in-page player or by downloading the mp3. You can follow along with the presentation in her slides.

0 comments voice your opinion now!
oauth dpcradio podcast dpc11 conference session lornamitchell


Artur Ejsmont's Blog:
A few words on bugs and software quality
February 08, 2012 @ 13:50:40

In this new post to his blog Artur Ejsmont shares some of his thoughts on bugs and how they can effect the quality of your software. He touches on topics like handling bug reports, how random code changes effect them and how effective a code review can be.

From time to time I see bugs in the code and I start thinking "really? is it possible that no one noticed that bug before? am i the first person to see this code?". I thought it might be worth writing a little post on what helps me to deal with bugs and software quality in general and what are the common pitfalls in developer's thought process. Although it is not a very extensive post i hope it may inspire some developers to try new approaches.

Other topics he offers for consideration involve the fact that bugs will never fix themselves (they might disappear in a refactor though), that the bug is almost never in the language/data source's code and how automated (unit) testing can help to find new bugs before they're released to the users.

0 comments voice your opinion now!
software quality bugs opinion suggestion testing


Developer Drive:
Building a PHP Ad Tracker Data Object Design and Coding
February 08, 2012 @ 12:57:54

Continuing on from the first part of their tutorial series about creating a simple ad tracker for your web application, Developer Drive is back with part two, a more in-depth look at the actual object design and code.

In our last PHP Ad Tracker lesson, we constructed the database tables for our ad banner application. Now we are ready to construct the data object that will hold the variables and functions that will display, add, edit and delete the data in those tables.

They cover each of the variables they'll be using with a summary of what they're used for as well as the various functions to be defined and what they'll return. Following this, they get into the actual development - creating an "ads" class and defining the methods to get the current ad count, get the number of clients and pull the actual client/ad data.

0 comments voice your opinion now!
ad tracker tutorial object design code


Refulz.com:
CakePHP evolves to 2.0
February 08, 2012 @ 11:15:43

On the Refulz.com blog there's a new post looking at some of the new features in CakePHP 2.0 including its use of lazy loading, the CakeEmail library and the new class loader.

With CakePHP 2.0, they have dropped support for PHP 4 and have refactored the library code to make it strictly complaint with PHP 5.2+. Modeled on Ruby on Rails (RoR), CakePHP is a tough competition to Zend framework, Symfony and CodeIgniter.

Besides the topics mentioned above, he also goes into the details of the new CakeRequest and CakeResponse models (to access information about teh current request/response). Summaries of all of the new functionality are provided along with some sample code where needed to illustrate.

0 comments voice your opinion now!
cakephp version2 features lazyloading model email loader


Ed Finkler's Blog:
The MicroPHP Follow-up FAQ
February 08, 2012 @ 10:50:14

Following up from his (now infamous) MicroPHP manifesto, Ed Finkler has this new post to his blog answering some of the common questions he's gotten about his beliefs.

My previous post, The MicroPHP Manifesto, resulted in much excitement. In between fits of rage and crying, I found some time to answer folks questions, and also discuss the topic on the /dev/hell podcast with my cohost Chris Hartjes. To summarize and address some of the common questions, I felt I should write a small FAQ.

Questions asked so far include:

  • So you think full-stack frameworks suck?
  • You need a large framework to enforce best practices!
  • You should check out my microframework!
  • How do you choose what gets listed in the MicroPHP code collection?
  • Why do you hate Rush?

If you have a question you don't see listed, drop him a note and he'll add to the post with more answers.

0 comments voice your opinion now!
microphp manifesto faq microframework library opinion



Community Events





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


community custom framework release interview opinion component conference test podcast development language series database application api symfony2 unittest introduction phpunit

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