Jan 20 2008

Discovering Symfony php framework: part 1, installation

Published by Gilles under Programming, Web, php

symfony.gif

Symfony is an open source web application framework for 5 projects. As a framework, it aims to speed up the creation and maintenance of web applications, and to replace the repetitive coding tasks by power, control and pleasure.

Main features

  • PHP5 (OO)
  • MVC pattern
  • Follows the RAD paradigm
  • Database agnostic
  • ORM layer built on propel
  • Internationalization layer
  • YAML config files
  • Built-in forms validation/repopulation
  • Cache management
  • Authentication and credential features
  • URL rewriting
  • Built-in paging, sorting and filtering features
  • Plug-ins system
  • Ajax ready

The purpose here is not to replace the very complete documentation of Symfony. It's just a kind of "roadmap summary" of what I'have done until now with Symfony.

Installation

Thanks to the large documentation of Symfony, the installation has been very easy on my Linux Gentoo ( 5.2.1):

1. Install Symfony core

As I can't use pear on my server, I downloaded the latest version trough SVN:

[[code]]JCBzdm4gY28gaHR0cDovL3N2bi5zeW1mb255LXByb2plY3QuY29tL2JyYW5jaGVzLzEuMCAu[[/code]]

(and that's it!)

2. Setting up a new project

Symfony consists of a hierarchy of 3 pieces:

  • a project
  • application(s)
  • modules

2.1 Create the project

[[code]]Jmd0OyBta2RpciB+L215cHJvamVjdA0KDQomZ3Q7IGNkIH4vbXlwcm9qZWN0DQoNCiZndDsgcGhwIC9wYXRoL3RvL3N5bWZvbnkvZGF0YS9iaW4vc3ltZm9ueSBpbml0LXByb2plY3QgbXlwcm9qZWN0[[/code]]

Symfony will create a (quiet explicit) directory structure that looks like this:
[[code]]YXBwcy8NCg0KYmF0Y2gvDQoNCmNhY2hlLw0KDQpjb25maWcvDQoNCmRhdGEvDQoNCmRvYy8NCg0KbGliLw0KDQpsb2cvDQoNCnBsdWdpbnMvDQoNCnRlc3QvDQoNCndlYi8=[[/code]]

2.2 Create the application

[[code]]Jmd0OyBzeW1mb255IGluaXQtYXBwIG15YXBw[[/code]]

This will create a [
CODE:
  1. ]bXlhcHAv[

] directory in the [

CODE:
  1. ]YXBwcy8=[

] folder of the project root, with a default application configuration and a set of directories ready to host the file of your website:

[[code]]YXBwcy8NCg0KbXlhcHAvDQoNCmNvbmZpZy8NCg0KaTE4bi8NCg0KbGliLw0KDQptb2R1bGVzLw0KDQp0ZW1wbGF0ZXMvDQoNCg==[[/code]]

Some files corresponding to the front controllers of each default environment are also created in the project [
CODE:
  1. ]d2Vi[

] directory:

[[code]]d2ViLw0KDQppbmRleC5waHANCg0KbXlhcHBfZGV2LnBocA0KDQo=[[/code]]

[
CODE:
  1. ]aW5kZXgucGhw[

] is the production front controller of the new application. To run your application in the development environment, call the front controller [

CODE:
  1. ]bXlhcHBfZGV2LnBocA==[

].

Set up your Apache config:

[[code]]Jmx0O1ZpcnR1YWxIb3N0ICo6ODAmZ3Q7DQoNCiAgU2VydmVyTmFtZSBteWFwcC5leGFtcGxlLmNvbQ0KDQogIERvY3VtZW50Um9vdCAiL2hvbWUvc3RldmUvbXlwcm9qZWN0L3dlYiINCg0KICBEaXJlY3RvcnlJbmRleCBpbmRleC5waHANCg0KICBBbGlhcyAvc2YgLyRzZl9zeW1mb255X2RhdGFfZGlyL3dlYi9zZg0KDQogICZsdDtEaXJlY3RvcnkgIi8kc2Zfc3ltZm9ueV9kYXRhX2Rpci93ZWIvc2YiJmd0Ow0KDQogICAgQWxsb3dPdmVycmlkZSBBbGwNCg0KICAgIEFsbG93IGZyb20gQWxsDQoNCiAgJmx0Oy9EaXJlY3RvcnkmZ3Q7DQoNCiAgJmx0O0RpcmVjdG9yeSAiL2hvbWUvc3RldmUvbXlwcm9qZWN0L3dlYiImZ3Q7DQoNCiAgICBBbGxvd092ZXJyaWRlIEFsbA0KDQogICAgQWxsb3cgZnJvbSBBbGwNCg0KICAmbHQ7L0RpcmVjdG9yeSZndDsNCg0KJmx0Oy9WaXJ0dWFsSG9zdCZndDs=[[/code]]

2.3 Create a module skeleton

To add a [

CODE:
  1. ]bXltb2R1bGU=[

] module to this application, type the following commands:

[[code]]Jmd0OyBjZCB+L215cHJvamVjdA0KDQomZ3Q7IHN5bWZvbnkgaW5pdC1tb2R1bGUgbXlhcHAgbXltb2R1bGU=[[/code]]

No responses yet

Dec 24 2007

Javapolis 2007

Published by Gilles under Conferences, Java

javapolis07.jpg
Wednesday December 12th, I went to the Javapolis 2007 edition. After some troubles finding the right tram to go to the right place, I finally catch... the right bus! Arriving at the entrance, I met a colleague of mine, that had a very bad news: "they don't know us!". After some phone calls, we ended up to find our two badges in a partner stand. (We will have to thanks our boss!)

No time for food, James Gosling's speech, "The state of the java universe", will begin in a few. Three rooms totally full listened to James attentively. We had news about Java, Fx andNetbeans + a cool demo with 2 funny robots.

The second conference, I saw was the new SoapUI presentation by Ole Matzura. As a developer, I did not find it very useful but it seems to be really a nice tool for testers.

Time to eat now! I met a colleague of mine wandering for his accreditation :) After getting it, we began the endless queue to get our lunch disappointing hot dogs. Really, that did not do it!
After this, we went to see the Google web toolkit presentation by Dick Wall. A tool that lets you build applications by converting class into javascript. Very interesting, but the demo was a little bit confused.

The next conference I saw was the "SOA Development using JBossESB" by MarkLittle. His presentation was very clear! He explained the place of and (two buzzwords of choice today...) in the development process an their places in the WS-* architecture.

The last conference I saw was "JSR 318 - Enterprise JavaBeans 3.1" by Kenneth Saks. Too tired, I had to leave at the half of the presentation. (I had still to catch a bus and two trains to come back home...).

Finally what I liked:

  • the quality of the conferences I saw
  • the whiteboards concept

... and what I didn't like:

  • the lunch queue
  • the lunch
  • the commercial (but normal) part (stands)

No responses yet