5 ms·
Sinatra clone in PHP
- seldo 16y agoThis is pretty early but nifty, and might help us in our ongoing efforts to move away from our Ruby prototypes. Needs helpers and halting to be properly useful, but will definitely keep an eye on it.
- flapjack 16y agoThanks! I'll get to helpers and halting as soon as I can, and email you when they're done. Update: Done.
- TamDenholm 16y agohttp://www.sinatrarb.com/ http://www.sinatrarb.com/ For those (like me) that had no clue what sinatra was before this.
- leftnode 16y agoI've written one too called Hoboken, the city where Sinatra was bron. I don't have a complete set of docs, but it's definitely useable. http://github.com/leftnode/Hoboken http://github.com/leftnode/Hoboken My personal site uses it: http://leftnode.com http://leftnode.com I'll have to check this out to see how it competes :).
- petervandijck 16y agoNice, I liked Hoboken (lived there). Great steak.
- codeguy 16y agoLooks promising! I've actually been developing my own Sinatra clone in PHP5. I've called it "Slim". It has RESTful GET, POST, PUT, DELETE routing. It has before and after callbacks. It has Page Not Found handling, halting, helpers to set custom response codes, and easy-to-extend templating (use Smarty, Twig, or whatever you want). See more at: Documentation: http://slim.joshlockhart.com/ http://slim.joshlockhart.com/ GitHub (with Download): http://github.com/codeguy/Slim http://github.com/codeguy/Slim Still very much a work in progress, but thought I'd go ahead and get the word out. Enjoy! Josh
- jwpage 16y agoSome other ones: http://github.com/sofadesign/limonade http://github.com/sofadesign/limonade http://github.com/jim/fitzgerald http://github.com/jim/fitzgerald http://github.com/fabpot/Silex http://github.com/fabpot/Silex (based on Symfony 2)
- tmountain 16y agoUsed limonade in a few projects recently that required me to code in PHP. It's easy to get rolling with and free of outside dependencies.
- c00p3r 16y agoWhat those PHP guys are unable to understand, is that all the coolness and beauty of Sinatra comes from the lack of () {} $ and other meaningless (it this context) symbols and words, like function and echo. The same effect is in Clojure, but it is a little bit more difficult to explain. They're lost the beauty of Lisp (especially Scheme) when they broke the clarity and unambiguity of the syntax pushing all those foreign symbols into it. Moreover, they also renamed and broke most of common idioms, using words that could be better as a variable names instead of keywords. So, it is not a Lisp dialect, even not so-called Lisp-1. It is just yet another JVM-targeted pseudo-functional language, which, OK, looks like lisp to those who never seen a Lisp before. But, its cool (and ugly), I must admit. ^_^
- there 16y agoWhat those PHP guys are unable to understand, is that all the coolness and beauty of Sinatra comes from the lack of () {} $ and other meaningless (it this context) symbols and words, like function and echo. i think "those php guys" are well aware that their language is not ruby and care more about getting work done than whether they have to type dollar signs and brackets.
- c00p3r 16y agoGetting work done is a different goal, and, indeed, an understanding that it is impossible to repeat Sinatra isn't required for getting work done.
- dhotson 16y agoI think c00p3r makes a valid point. PHP makes it very hard to write "beautiful" frameworks like Sinatra. There's a whole bunch of crufty looking stuff in PHP that is unavoidable. That doesn't stop me from writing PHP and getting-shit-done. That's an entirely different argument though.
- ElbertF 16y agoBasically what you're saying is that all the beauty of Sinatra comes from Ruby, I disagree.
- Argorak 16y agoAside from this being "Sinatra clone" #100, I think most people do not understand that Sinatra is about much more than its query and before/after-filter DSL: Its about its plugin API, its great integration into Rack (which PHP doesn't have, middleware solutions or not), its ability to host multiple apps in one process and its large and well-written documentation. It is easy to implement the query API in any language that supports anonymous functions, but that doesn't make it Sinatra. This one is not even a good example of a clone: its really bare, only implements the minimal set to "look like sinatra". It doesn't even have a good request or response object.
- dhotson 16y agoHeh, it's funny you should mention that.. I had a go at a Sinatra + Rack style framework in PHP a little while ago. Check it out: http://github.com/dhotson/kelpie http://github.com/dhotson/kelpie http://github.com/dhotson/kelpie/blob/master/demoapp.php http://github.com/dhotson/kelpie/blob/master/demoapp.php It's got its own Rack style web server built in ... kinda crazy huh? ;-)
- Argorak 16y agoIt looks nice and much cleaner :). Is there a reason for the use of doc comments? My problem in the PHP world is: you have your Rack-style server. Another project has a different style. In Ruby, every framework nowadays is on Rack.
- dhotson 16y agoNo particular reason it uses docblocks.. it's just what I thought looked decent at the time. I'm usually not a fan of comments as code, but in this case it's kinda neat.. :-) It's a real challenge to make nice looking mini languages in PHP. At least Ruby gives you a bit more rope to make clever little languages. /envy But yeah, I really wish PHP had a web server interface like Rack that was more widely accepted. The two that look the most promising are: http://mongrel2.org http://mongrel2.org http://github.com/indeyets/appserver-in-php http://github.com/indeyets/appserver-in-php Also, the downside of implementing your own web server is that basically zero existing PHP code will work with it. It's because you have to re-implement all the usual superglobal stuff $_GET $_POST $_SESSION etc.. .. I consider that a plus. ;-)