Writing PHP

It has come up a number of times in the past few weeks, people I know looking for pointers on getting started writing their own website in the PHP script language. After sending my last lengthy email on the subject to a friend of mine I thought to myself; “Self? Why don’t you put that in your blog so you don’t have to wing it every time someone asks?” and Self responded “Good idea! Glad I thought of it!”.

So here we (Me and Self) are, copying and pasting stuff from my Sent folder:

I have enjoyed my PHP coding time and
have written some fairly large applications with it as well as used it
for plenty of dirty work (my Webalizer and SQL backup cron scripts, for
example, are all written in PHP and executed like a shell script) on the numerous servers under my (choke) “care”.

Books are great but I think you’ll find as useful of information on a
few good websites. Literally everything I’ve learned has come from the
web. I do actually own 2 PHP books (Beginning PHP and Professional PHP,
both by Wrox Press) but I only bought them for the developers at the
office to use (and I had Amazon points to burn).

Here are a few of the most useful website:
http://www.devshed.com/ (good boards, excellent articles. A DevShed
article is where I actually started with my very first PHP code).

http://www.php.net/ – I ONLY use the online, annotated manual for syntax
reference (you can do php.net/functionname and it’ll find it
automatically). The annotations are EXCELLENT.

http://www.phpbuilder.com/ – Not a lot of new content over the past
year, but all the old articles are there for the taking. And they’re
worth reading… The boards here are ok, the next best alternative for
PHP boards when you need help – after asking me of course!)

http://www.zend.com/ – the Zend engine’s authors. Great articles but
tend to be more advanced and geared more towards architectural design
rather than simply getting the damn thing working. Otherwise, a great
place to go once the projects start getting too big and you want to
start implementing some proven design philosophy.

http://www.weberdev.com/ – This is considered the “examples” repository.
Their database includes a lot of the stuff from the manual, but a lot
more is user contributed. If you wanted to see sample code on how to
validate a credit card number or take local time and find the time in,
say, Israel, this is a good place to start.

http://www.phpclasses.com/ Once you know HOW to do something don’t keep
reinventing the wheel if you can help it. the PHP Class Repository has a
lot of very useful classes (read the section of the PHP manual labeled
Classes) that do things like validating user input, abstracting
databases, etc…

http://pear.php.net/ – This aims to be the CPAN of PHP. The
documentation isn’t very good but there is some really good stuff here. I am particulary fond of the PEAR base class, PEAR_DB, PEAR_ERROR (error handling) and am investigating the rest as time and the current need permits.

http://php.weblogs.com/ – The home of the ADOdb database abstraction
class package. An abstraction class(s) hides the database server
specific code from you by giving you an API common to all databases.
Then you can spend your time writing the sql instead of coding
mysql_connect or pg_connect code. This site is also a blog and the
content is usually pretty good, too.

Lastly, if your intention is mainly to get a website up and running more
than learning PHP because it’s fun, what you’re looking for may already be out there. The two best places to look for existing
code are http://www.freshmeat.net/ and http://www.hotscripts.com/

I know this isn’t much but it should be enough to give the newbie a leg up without being at the mercy of Amazon or Barns & Noble.

When the time permits I will go through my assorted list of favorite projects, development and management aids and time savers.

Comments are closed.


π