Symfony is an open-source PHP web framework, from their own blurb:
“Based on the best practices of web development, thoroughly tried on several active websites, symfony aims to speed up the creation and maintenance of web applications, and to replace the repetitive coding tasks by power, control and pleasure.
Symfony provides a lot of features seamlessly integrated together, such as:
- simple templating and helpers
- cache management
- smart URLs
- scaffolding
- multilingualism and I18N support
- object model and MVC separation
- Ajax support
- enterprise ready.”
Cool stuff.
Unfortunately the instructions lack those vital “For Dummies…” steps absolute beginners need (at least this one does).
So, more as a note to myself, this is how to install the symfony sandbox on WinXP.
- Unpack the .tgz file to your www folder in WAMP (I assume XAMPP is similar). Using 7zip, this was a two-stage process so a bit of jiggery-pokery to get the sf_symfony folder directly under the www folder was required.
- Writing http://localhost/sf_sandbox/web/index.php into your browser successfully displayed the congratulations page.
- Open (or create) the file sf_sandbox/config/schema.yml and add the data model as provided.
- Now it’s time to break out the command line skills and fail, especially if you’re an absolute beginner to all this.
Edit your Path Variable first
The command line instructions given are for *nix, so before ploughing ahead we need to give Windows a clue first, namely tell it where it can find php.exe.
- Right-click My Computer and select Properties.
- Go to the advanced tab and click the Environment Variables button.
- In the system variables list of the resulting popup window, select the Path variable and click the Edit button.
- Scroll to the end and type ;c:\wamp\php\ or equivalent path to the folder with php.exe in it.
- Click OK all the way out to set the variable.
We’re good to go!
Get a command line
- Go to Start > Run…
- Type in cmd and press return.
- You need to be in the sf_sandbox folder. Two commands are needed – cd and cd.. where cd means “change directory” and cd.. is “up a directory”. Eventually you’ll get to something like c:\wamp\www\sf_sandbox.
Building the first project
Back to the instructions except you drop the exclamation mark:
php symfony propel-build-model
Before executing the next two lines you need to enable read/write permissions on the sf_sandbox/data/ folder first. In Windows Explorer:
- Find the folder, right-click and select Properties.
- Untick the Read-Only flag and allow the changes to propagate.
We’re ready to execute more commands now:
php symfony propel-build-sql
php symfony propel-insert-sql
php symfony propel-generate-crud frontend post Post
php symfony propel-generate-crud frontend comment Comment
php symfony clear-cache
Success! It should be possible to see each of the two modules we just created without errors and hopefully carry on with actually learning symfony.
Technorati Tags: symfony, php, php-framework, how-to