 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Tom Butler: PHP PSR-0 Pretty Shortsighted, Really
by Chris Cornutt April 16, 2013 @ 13:12:14
In a new post to his site Tom Butler gives some reasoning as to why he thinks PSR-0 is shortsighted and some examples of a possible better alternative.
A little background for those unaware of what PSR-0 is: There's a self-declared PHP "standards" group called PHP-FIG attempting to push several "standards" throughout the PHP community. [...] I have little interest in debating the politics behind pushing standards or whether small groups of developers trying to make decisions that affect the entire community is good or not, but I do object to the PSR-0 standard itself. My issues are purely practical, PSR-0 reduces flexibility and makes life more difficult for developers
While he likes the idea of a standard way to be able to include third-party libraries that can be reused in multiple systems, he suggests that it answers the wrong question. In his view, it should be up to the library/tool developers to ensure the structure of their code to work with a standard, not the other way around. He points out that a "standard" is something that should apply to all situations and some of the workarounds that are needed for PSR-0 negate this idea.
In his alternative method, he suggests an "Autloadable" interface that can be implemented by the library/tool that includes a "load" method to handle the actual class loading. Then this autoloader would be registered via a json configuration file for the package. This allows the developer to control the loading and place any exceptions they might need into their own logic instead of trying to work around possible issues with the PSR-0 loading scheme.
PSR-0 is a bad solution to a good problem. If you take anything from reading this post, remember this: If the standard defined how autoloaders could be extended, rather than how autoloaders worked, then each library or vendor could provide its own extension to the autoloader and everyone would be happy.
voice your opinion now!
psr0 autoload standard opinion shortsighted alternative
Community News: Nomad PHP - the Virtual PHP User Group
by Chris Cornutt April 09, 2013 @ 12:41:21
If you've wanted to get involved in a PHP user group but either don't have one in your area or travel so much it makes it impractical, there's a new group that might interest you - Nomad PHP. It's a virtual user group that you can attend. It's still in the beginning stages, but you can express your interest and get more details as they come.
Tired of seeing all the great speakers other PHP User Groups are hearing and lamenting that there is no group near you? Nomad PHP User Group is just for you. We meet on-line, so you can participate wherever you are [and] will have well known as well as brand new speakers. You'll also get access to the recordings to review later.
They point out that this isn't intended as a replacement for a local user group if you have one - interaction with peers and being a part of the community is still important. This is just an alternative. If this sounds interesting, head over and enter your information to be contacted with more info about the group.
voice your opinion now!
usergroup nomadphp virtual alternative online
PHPMaster.com: Avoid the Original MySQL Extension, Part 1
by Chris Cornutt February 15, 2013 @ 11:13:29
On PHPMaster.com today there's a new post, the first in a series, about avoiding the original MySQL extension in favor of what mysqli has to offer. The cover some of the basics of the extension and include code showing its use.
Experienced developers eschew the original MySQL extension because of its abandoned status in PHP. Nascent web developers, however, may be completely oblivious to its dormant past and dying future. [...] It is therefore the intention of this two-part article to raise awareness among developers who still use the MySQL extension, inform them of its problems, and to help them switch over to an alternative extension.
They start with a brief look at the "what's wrong" with the MySQL extension (including its upcoming deprecation). The article then gets into the basics of MySQLi and how to do things like make a connection and run a few queries. There's also a bit about prepared statements and the built-in ability to do "multi-queries" (complete with rollbacks).
voice your opinion now!
mysql extension avoid mysqli introduction tutorial alternative
Rob Allen: Sending an HTML with text alternative email with ZendMail
by Chris Cornutt November 02, 2012 @ 10:26:20
Rob Allen has a quick tutorial posted to his site today showing you how to send an email with the ZendMail component of the Zend Framework 2 that contains HTML but provides a plain text backup in the same message.
Sending a multi-part email with ZendMail is easy enough, but if you want to send an HTML email with a text alternative, you need to remember to set the content-type in the headers to multipart/alternative. As this is the second time I had to work this out, I'm noting it here for the next time I forget!
The rest of the post is the code you'll need to send a simple email with a text and HTML body sections, configure the headers (to, from, etc) and the "multipart/alternative" header to make the HTML or plain text switching work correctly.
voice your opinion now!
zendframework2 mail tutorial send alternative html plaintext
Erskine Labs Blog: What should they know of PHP who only PHP know?
by Chris Cornutt July 08, 2011 @ 12:15:01
On the Erskine Labs blog today there's a new post from Wil Linssen with a suggestion to PHP developers who specialize in the language - take the time to learn another language and broaden your skills.
So many languages share fundamental principles, and indeed many are even derived from the same concepts, but because they differ in their approach there's something new to understand in each. It's these differences that will frequently bolster your understanding of your primary language, or indeed of programming as a whole.
He notes that it's not just PHP developers that pigeon hole themselves into one language - developers on other languages do to. He recommends they lift their heads up and branch out and stop attacking other languages with "language X is best" articles.
It's stepping outside of your comfort zone and engaging with the underlying concepts of the languages and tools you are using that will enable you to grow as a developer.
voice your opinion now!
knowledge language alternative principles opinion
Johannes Schluter's Blog: Escaping from the statement mess
by Chris Cornutt May 19, 2011 @ 09:30:45
In a new post to his blog Johannes Schluter suggests an alternative to using prepared statements in PHP applications using a database - creating a handler method that allows for dynamic queries as well as proper escaping of values.
Now prepared statements were a nice invention some 30 years ago abut they weren't meant for making things secure and so they do have some shortcomings: One issue is that preparing and executing a query adds a round-trip to the server where it then requires resources. [...] With prepared statements you first have to build the list of place holders (the exact amount of place holders (?) separated by a comma, without trailing comma) and then bind the values and mind the offsets when having other values - this typically becomes ugly code.
He includes the code for his alternative, a function using the mysqli extension to let you create dynamic SQL that still uses placeholders and proper escaping to prevent both SQL injection issues and resources problems caused by the multiple hops back to the database.
voice your opinion now!
prepared statement database alternative mysqli
Stefan Koopmanschap's Blog: API documentation in Jenkins with DocBlox
by Chris Cornutt May 02, 2011 @ 11:26:40
In a new post to his blog Stefan Koopmanschap shows you how to get DocBlox installed for your documentation-generation needs as an alternative to phpDocumentor.
People using PHP that want API documentation usually automatically think of phpDocumentor, which used to be the de facto standard for generating API documentation from your PHP projects. However, the project has been dormant for a long time now and definitely does not support new PHP features such as namespaces, so it was really time to look for an alternative. In this blogpost, I'll show you how I set up my Jenkins CI to use DocBlox, one of the new API documentation generators currently available.
The DocBlox project is in active development and supports additional things in top of the current feature set phpDocumentor includes. Stefan gives you the exact XML you'll need to include in your Jenkins build file (and the phpDocumentor line it will likely replace) that builds out the documentation to a given path. He's given an example of his full build file to give you some context too.
voice your opinion now!
docblox phpdocumentor jenkins build alternative
|
Community Events
Don't see your event here? Let us know!
|