 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Rob Allen: Simple logging of ZF2 exceptions
by Chris Cornutt 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.
voice your opinion now!
simple logging exception handling service event listener tutorial
Systems Architect: Performance benchmark of popular PHP frameworks
by Chris Cornutt April 24, 2013 @ 12:04:31
On his site today Lukasz Kujawa has a post that compares some performance benchmarks of several popular PHP frameworks including Slim, CodeIgniter, Laravel, Symfony2 and Zend Framework 2.
There are many assumptions around performance of different PHP frameworks. I frequently hear strong opinions about superiority X over Y in this context. There are companies writing new PHP frameworks from scratch because available solutions are too slow for them. What does it really mean? Does the framework performance matters? Before answering this questions lets check how slow is your framework!
He took the "quick start" projects provided for each of the examples and ran some tests with the Apache Benchmark (ab) tool against EC2 instances, all configured the same way. The results weren't overly surprising with Slim beating the others hands down (it's a micro-framework after all) and Kohana and CodeIgniter coming in second and third. The frameworks with more overhead like Zend Framework and Symfony ranked some of the slowest.
voice your opinion now!
benchmark framework test apachebenchmark ab results
Vance Lucas: Valitron The Simple Validation Library That Doesn't Suck
by Chris Cornutt 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.
voice your opinion now!
validation library valitron simple dependencies
PHPMaster.com: Simplifying Test Data Generation with Faker
by Chris Cornutt February 19, 2013 @ 12:09:02
In a new post to PHPMaster.com today, Rakhitha Nimesh takes a look at Faker, a tool that can be used to generate random test case data as a part of your workflow.
Testing is an iterative part of the development process that we carry out to ensure the quality of our code. A large portion of this entails writing test cases and testing each unit of our application using random test data. Actual data for our application comes in when we release it to production, but during the development process we need fake data similar to real data for testing purposes. The popular open source library Faker provides us with the ability to generate different data suitable for a wide range of scenarios.
Faker uses built-in data providers like "Person", "Company", "DateTime" and "UserAgent" to give you randomized output from the data sets you define. Code is included showing how to create the provider in your objects, extending the correct provider and making a request for a property. A real-world example is also included about testing an email marketing engine for address, title, name and content. There's also a little bit added at the end showing how you can increase the randomness of the results returned by "seeding" the Faker engine.
voice your opinion now!
test data generation faker library object provider tutorial
Brandon Savage: Effective Refactoring Strategies
by Chris Cornutt December 24, 2012 @ 11:24:57
In a recent post to his site, Brandon Savage has a few helpful hints to keep in mind when you're refactoring your applications to make them easier to maintain (and possibly perform better) in the future.
The downtime [of this week] provides a perfect opportunity for the aspiring software developer to do the one thing they are always told there's no time to do: make the code better for better's sake. With few deadlines and plenty of free time, most developers can get a few hours of refactoring in to their code towards the end of the year. They can rearchitect sections that were implemented with haste in September; they can write tests for sections that were untested in April. Put another way, the "lost week" can be redeemed.
He has a few recommendations, each including their own brief summary:
- Test Everything First
- One Method, One Job (Also One Class, One Job)
- Don't Be Afraid Of More Objects And Classes
- Remove Dead, Unused, Unnecessary or Old Code
- Document Your Code
Check out the full post for the summaries and links to other useful resources.
voice your opinion now!
refactoring tips test single responsibility oop documentation
Anthony Ferrara: Designing An API Simplified Password Hashing
by Chris Cornutt 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.
voice your opinion now!
api design questions password hashing simple alpha
|
Community Events
Don't see your event here? Let us know!
|