Reputation: 113
I'm about 11 months into writing a pretty extensive HTML5-ready video deployment library for PHP. My client is paying me to write this library in exchange for a license to use an implementation of it, which I am also currently writing. I have been basically keeping a huge PHP file (60Kb at this point) that contains all of my object-oriented classes. The system I've built requires in this file on every page, which I imagine would be frowned upon. Don't get me wrong, I'm no newbie when it comes to PHP. I have been writing PHP for about two years now, and used nearly all of its most advanced functions. I would, however, like to improve still, and I believe that my authoring strategies are a weak point for me.
I love jQuery for its authoring simplicity. It makes writing repurposable code so much easier than PHP does, at least for me. I have been using jQuery extensively throughout this After reading this document I felt quite comfortable with the methods that were considered "best practice". Can anyone recall a similar resource which deals with PHP?
My intent here is to learn a better practice for writing PHP, without losing the low-level abilities and jumping over to another library like CodeIgniter. I simply don't like the idea of writing a library based upon another library; I would imagine that my system would leave a much larger footprint and use more resources.
Upvotes: 2
Views: 145
Reputation: 10356
First of all, you can't compare a library to a language. Apples and oranges. Unfortunately there's no single source of ultimate knowledge when it comes to PHP. I can only suggest some reading material I have found quite useful.
include
constructs;Also, if you like to learn by examples, take a look at these open source PHP libraries that I consider rather well written as far as following best practises goes:
If you have the resources, I would highly suggest you break down that large file: put every class into its own separate file. Cover the library with unit tests to be sure your code does what it's meant to do.
Edit
@lsmith tweeted about a site called PHP: The Right Way. This is probably the closest you can get to a single document about best practices.
Upvotes: 3