A URL shortener in a couple of hours
I have been aware of Silex for a while as a nice microframework based on Symfony2, and have looked into it a couple of times to see if it would be useful for a project. So far though, the projects I was working on seemed to need more than just Silex, so I picked Symfony2 instead. This morning, I decided to dig into Silex a bit more with a real-world project I still wanted to develop myself: A URL shortener.
Silex is one of the many microframeworks we've seen pop up recently. Contrary to most other microframeworks, however, Silex is built on top of an existing open source project: Symfony2. A microframework is a very small framework which basically does nothing more than bootstrap and handle your request and response. Though the microframeworks cater to a very specific need, I really like the approach of not needing a full framework for a project that clearly is simple enough not to need one.
Some things I really like about Silex are:
- Built on top of existing open source components
- Packaged in a phar package
- Extensible: There are extensions available to the Silex core, and I can extend it even more
This morning, I sat down to have a look at Silex and see how it works. I simply downloaded the phar, set up my basic project, and started working on setting up what I had in mind. Every time I got stuck or needed some info, I just Googled the topic to find the answer.
And this is where the first "problem" arose. I followed the steps in one of the pages I found on the official Silex and ran into an error telling me Silex\Extension\TwigExtension could not be loaded. Thanks to @Stof70, however, I found out that actually, I was looking at an old version of the documentation, and Extensions had been renamed to ServiceProviders. After changing my code, everything was working again!
Using this approach, it only took me a couple of hours to get a working version of my URL shortener. I did this by a constant refactoring, starting off with a very simple version and then constantly improving this code up to a point where I had what I wanted. Quite nice. Now it's time for some real-life testing
What I've found is that Silex (or any other microframework for that matter) is an excellent approach for small projects where you start with an idea of what you want to build and then improve on your existing code. It is very tempting to put in hackish solutions, which is OK if you keep on improving your code but you have to actually do that and not keep the hackish solution.
Another great situation where you might want to use a microframework is for quick prototyping, if you want to build a quick prototype for a customer to show them what can be done, and have the opportunity of rebuilding it later for the final version, a microframework will give you everything you need for the basic setup. Quite nice! So try it! Just take a couple of hours and an idea of a simple site or app you want to build, and start building. Even if you never use it later on, you'll have learned something new, which is always good.
October 14, 2011 - tags: silex, php, Symfony2, symfony, prototype, microframework
glutathione iv injection
: powered by potent antioxidant glutathione as well as vitamin c, magnesium, and b vitamins, this iv takes only 15-30 minutes and can energize after a long and stressful week or as part of a longevity protocol. when you find the best facial cream for you, be sure to use it consistently. when they come together, they usually create either a boy or a girl; two x’s makes a girl, and an x and a y creates a boy.
voice recorder with usb port
: to find and download the philips sound drivers please choose the appropriate philips voice tracer digital recorder lfh0662 2 5 things to do with school or church youth groups navigate: humor --> executive toys and desktop devices --> digital voice pen recorder. olympus professional dictation systems are designed to dramatically increase efficiency and streamline operations.
microscope hans janssen
: the functional requirements of the system will dictate the hardware and software specifications, for example the read / write capabilities of the rfid tags will ultimately be dictated by the business objectives. use this printable as a handout or transparency to help prepare students for working . i like to have students complete this activity after they complete their microscope quiz. isolation is provided by the same gimbal piston element that provides unsurpassed performance in isolating optical tables, electron microscopes, precision balances, and 20 series tables. these are not high use items, nor are they used to tighten to extremes.
voice recorder wifi
: digital voice recorder with 4gb memory, noise reduction & intelligent file management. quick overview: tiny, featured packed digital recorder with unique "no battery drain" mode when connected to a single line telephone. package contents: vn-8100pc 2gb digital voice recorder.
Cheap Phentermine 3.75 Mg Out
: does phen375 work? most of the best fat loss pills contain some of the ingredients that are included in this pill, but they dont contain all nine of them. this combination of effective fat loss ingredients helps people to lose weight quickly and easily. while making use of the phen375 pills you can expect to loss close to five pounds a week. this is the best natural fat burner pill that can help lose weight in the short term and also over a long period of time. phen375, for instance, contains no phentermine but works in a similar manner by super-boosting the organism's metabolism and fat-burning mechanism, decreasing hunger and cravings for food, and increasing energy. due to the fact its debut on the internet market scene in 2009, phen375 slimmers from the uk, usa, canada and all over the world report substantial fat burning with having zero of the troublesome and typically dangerous side effects of phentermine! this weight loss drug is intended for patients 16 or older (but not younger) who are obese and have another serious condition. the patient would have to fall into the definition of obese based on a standard body mass index (bmi) calculation and have one or more of the following conditions: high cholesterol, diabetes, or high blood pressure, according to drugs.com heart disease is a serious disease that occurs directly in the heart and the blood vessel system that makes the heart operate. the most well-known type of heart disease is coronary artery disease and ischemic heart disease. in fact, heart disease is the number one killer in both women and men. the connection with obesity is because those that are obese normally suffer from common risk factors of heart disease like high blood pressure and high cholesterol.
glutathione supplement autism
: there was some concern when first joe passed away, and then may, that leslie would stop his music, but thankfully, he hasn't. otherwise, the existence of growth hormone injected or fed to the animals may interfere with the function of central nervous system in regulating the production of the child's hormones, thus increasing the severity of the symptoms and brain tumors and cancers as we mentioned in previous article. the home hydroponic gardener may not spend much time thinking about pests and diseases.