ZFSnippets.com – Zend Framework Code Snippets
Not so long ago I was working on a little project using the django framework and was looking for a simple nested set implementation, I found one that was good enough for my needs on djangosnippets.org. I thought this was pretty cool, and realised we didn’t have a one stop shop for Zend Framework code snippets. Symfony and CakePHP also have dedicated sites for this. I’m aware of generic snippets sites and pastebin sites, but I thought it’d be another good learning opportunity to build my own with the Zend Framework, for the Zend Framework.
I’ve ended up implementing a pretty simple site, ZFSnippets. The current basic implementation makes use of:
There are plenty of things I’d like to implement (and fix;)), but will have to see if I find anytime:
- A site search engine using Zend_Search_Lucene
- More flexible posting, probably using wiki style markup
- Version history for all snippets
- Moving to a stackoverflow.com style, trust model, allowing regular users to collaborate, edit and update snippets.
- Forgot my password link
- Contextual error handling and descriptions
- Accurate scoring/ranking, based on complex calculations.
I did actually spend quite a bit of time looking at markup libraries, coupled with HTMLPurifier, but it seemed like too much effort to start with, so I opted for a method of splitting the source code using hashes like pastie.
I like the idea of having a go with Zend_Search_Lucene, probably adding particular snippets to a queue for indexing whenever somebody posts one or comments on one.
Having built the site, I’m actually struggling to think of what might go on there. Helpers seem like an obvious one, but without building large, complex Zend Framework application, I don’t have much need for custom code, the framework does the leg work for me. Nevermind, if you think it might be any use to you, head on over there and have a browse around, although it’s a little low on content at the minute, or maybe subscribe to the feed and keep your eye out for anything interesting.
Tags: code snippets, PHP, php5, snippets, zend framework, zfsnippets









March 5th, 2009 at 4:15 pm
Thanks Dave. Your tool is bookmarked yet.
March 5th, 2009 at 11:38 pm
[...] na svém blogu psal seznam p?ipravovaných featur, takže je na co [...]
March 6th, 2009 at 2:13 am
[...] ZFSnippets.com – Zend Framework Code Snippets | DaveDevelopment Zend Framework Snippets! NICE [...]
March 6th, 2009 at 3:30 pm
You should replace the timestamp of each rss-entry by the timestamp the entry was entered, otherwise it is really difficult for many readers to distinguish between new and old entries.
But good job overall :)
March 6th, 2009 at 6:25 pm
@Uli – Done
March 6th, 2009 at 6:29 pm
Kinda not
March 7th, 2009 at 2:15 am
Hi, i was looking a zend snippets site for a long time, great job!
Do you think open source it some day?
Cheers
March 7th, 2009 at 6:35 pm
@Rho Yeah one day, once I know everything is secure and it’s tidied up a bit.
@Uli Still not fixed the date in the feed, I can’t work out what I’m doing wrong
... 'pubDate' => date('r', strtotime($snippet->created)), ...March 9th, 2009 at 1:59 pm
I have problems to sign up for this site ZFSnippets.com, I come ’s e-mail confirmation
March 14th, 2009 at 12:40 pm
Very nice resource, thanks for setting up such a platform :)
Unfortunately, I’m having problems signing up with OpenID. I’m running my own provider using phpMyID and I’m able to sign in into other services such as Stackoverflow and Sourceforge, however when I try to log into ZFSnippets, it checks for Username/Password and but then returns to the register page saying “Login failed”.
March 14th, 2009 at 7:50 pm
@Mathias, I’ll have a look into that as a priority, don’t want to put people off registering.
April 6th, 2009 at 10:17 pm
[...] been just over a month since I launched zfsnippets.com and I’m very pleased with the reception it got, which spurred [...]
June 1st, 2009 at 8:55 am
is ZFSnippets.com dead?
i cant post snippets….
June 1st, 2009 at 1:56 pm
Bugger!
Yeah I think it’s ok now, possibly a dodgy opcode cache, I touched the main controller and everything seems fine now.
August 23rd, 2009 at 9:34 pm
Can’t register.
Looks great thought
April 26th, 2010 at 11:58 am
[...] been just over a year since I initially launched zfsnippets.com, it was a good little project for me to get used to the Zend Framework, but since [...]