Symfony in 5 minutes

blahboatsInternet and Web Development

Dec 13, 2013 (3 years and 7 months ago)

121 views

Symfony in 5 minutes




Why should I use a framework?



When should I use a framework?



6 good reasons to use Symfony



The technological benefits of Symfony in 6 easy lessons



10 criteria for choosing the correct framework

Why should I
use a framework?

A framework is not absolutely necessary: it is “just” one of the tools that is
available to help you develop better and faster!


Better, because a framework provides you with the certainty that you are
developing an application that is in
full compliance with the business rules,
that is structured, and that is both maintainable and upgradable.


Faster, because it allows developers to save time by re
-
using generic
modules in order to focus on other areas. Without, however, ever being tied
to

the framework itself.


Investing in the task, not in the technology

This is the basic principle of a framework: Not having to reinvent the wheel. And doing
away with foreboding, low value added tasks (for example, the development of generic
components) i
n order to fully focus on the business rules.

As an example, a framework will keep the developer from having to spend 2 or 3 days
creating an authentication form (which is not a specific task). The time that is saved can be
dedicated to more specific compo
nents as well as to the corresponding unit tests; giving
you solid, sustainable and high quality code.


Guaranteed upgradability and maintenance

In the longer term, a framework ensures the longevity of your applications. If a
development team works as they please, only that particular team will be able to maintain
and upgrade the application with ease. The way that a publisher supports a proprietar
y
solution.

On the other hand, the structure that a framework provides for the application makes it
possible to avoid this pitfall alltogether and it gives any developer
-

whether she
participated in its development or not


the ability to easily “adopt” a
n application, to
maintain it over time and to upgrade it both quickly and neatly, whenever necessary.

In this regard, a framework is not a black box! In the case of Symfony, it is still PHP… The
applications that are developed are not limited to the Symfo
ny universe, and they
are

natively interoperable

with any other PHP library, for example.

When should I use a framework?

Well... Whenever you need to, while developing a web application

or a site,
of course!

Why would you have a custom piece of furniture made if you could find one
that perfectly matches your décor, right off the shelf? The same is true for
computer applications: Before you dive in to create a framework, a little
survey w
ork is in order.


General needs vs. specific functions

Besides a framework, there are other solutions that are available to develop both Web sites
and Web applications: CMSs (Content Management System) and their supplemental
modules, as well as packaged p
rofessional solutions (CRM, e
-
commerce solutions, etc.). If
their native features line up perfectly with your immediate and future needs, no question
about it: Go for it! There is no point in reinventing the wheel.

On the other hand, when there are specifi
c needs, specific business rules or even the need
to mix building blocks (content and e
-
commerce, for example), a framework solution is
necessary: it allows an application to be developed that perfectly matches your current
needs, while still being innovat
ive.


The right questions

To make sure that you are making the right choice, both for the short as well as the long
term, it is necessary to ask the right questions:

1.

What are my current needs? Are they covered by a packaged solution?

2.

What skills do I need

if I choose a framework?

3.

Will the developed solution be upgradeable?

And finally, don’t fall into the trap of the “apparent simplicity of the requirements.” In many
cases it quickly becomes apparent that both the business rules and functions to be
implemented are just not so simple to put in place.

By the way, Symfony is also very well suited for “mini
-
projects.”



A framework can be tailored to all requirements.

...but that is not always necessary, especially when the requirements are of a more
g
eneric nature.

Before making your selection, map out your current and future requirements in
detail, and then compare the various solutions available on the market.

6 good reasons to use Symfony

Using a Framework is a good thing. Making the right choice is even better.
Without going too deep into things and in no particular order, here are 6
good reasons to use Symfony, from a strategic point of view


For technical aspects, click

here
.



1. Reputation

Quickly adopted by professionals active in this field following its launch in 2005, Symfony

today is a stable environment that is both well
-
known and recognized internationally. The
number of its references attests to this, as they have grown significantly since its launch.
Symfony is also an active community; developers, integrators, users and
other contributors
who participate in the on
-
going enrichment of this tool.



2. Permanence

Behind Symfony there is a company: Sensio. Created more than 12 years ago, Sensio is a
web agency that has many major accounts among its references. Envisioned fo
r its own
needs, the Symfony framework is today still the daily tool used by its own teams to develop
customer projects. Designed by professionals for professionals, Symfony is first and
foremost a pragmatic tool, the features of which address real
-
world
-
r
equirements.

Permanence is also something that relates to long
-
term support. Today, this support is
naturally provided by Sensio. But there is also an entire ecosystem that has grown up
around Symfony since its launch: the community (mailing lists, IRC, et
c.) and the many
other service companies that have invested in the framework.

Lastly, it is also with a view towards sustainable development that Symfony is distributed
under Open Source MIT license, which does not impose constraints and allows the
develop
ment of Open Source as well as proprietary applications.



3. References

Intranets, major general public sites, social networks, community sites, management and
workflow applications, etc.

Examples are not lacking: Hundreds of sites and applications of
all sizes and of all types trust Symfony.


This is specifically the case of Yahoo!, Dailymotion, Opensky.com, Exercise.com and even
applications such as phpBB.



4. Innovation

Symfony is ev
erything that you would come to expect from a framework: speed, flexibility,
reusable components, etc. Then there is the structure of what has been developed and the
use of best practices. Not bad!

But that is not all! Since Sensio has developed a habit of

shaking up the established order
and is always striving for excellence, Symfony (and its entire community) has developed a
sense of curiosity that goes well beyond PHP. And we do not hesitate to innovate by
seeking out ideas elsewhere and then adapt them
to the world of PHP, such as dependency
injection from the Java world.


In addition, Symfony, seeking out ongoing improvement in the productivity of developers,
envisioned the “web debug toolbar,” taken from other frameworks, whether PHP or
otherwise.



5. Resources

Symfony is everything that you would come to expect from a framework: speed, flexibility,
reusable components, etc. Then there is the structure of what has been developed and the
use of best practices. Not bad!

When using Symfony, you are
assured of never “being alone with your screen.” Whether a
question of community support (mailings lists, IRC, etc.) or company support (consulting,
training, etc.), you will always find the answers to your questions.


Starting from the principle that “an
undocumented line is a line that does not exist,” you
will also find many works dedicated to Symfony, which will help you throughout the
development of your sites and applications.



6. Interoperability

The idea behind Symfony: Don’t lock yourself up wit
hin Symfony! Allow yourself to build
applications that precisely meets your needs!


Symfony respects the existing “de facto standards” of PHP: PHPUnit, naming conventions
for classes, etc. Furthermore, Symfony also allows you to use certain of its software

building blocks (dependency injector, translations management, forms management, etc.)
without necessarily using the framework in its entirety

By the way, Symfony is so interoperable that, at the core, it uses external software building
blocks itself (ORM

Doctrine, Swiftmailer, etc.)!

The technological benefits of
Symfony in 6 easy lessons

Just as a mountain climber will choose a steel carabiner

over a plastic one, a
developer would much rather work with a framework that simplifies both his
life and his daily work. Otherwise, so much code to write…



1. Faster and less greedy

In the IT world, it is not rare occurrence for people to become
concerned with the
performance of an application… once they reach the end of the project! That is, once
everything has been designed at both the functional and the technology levels. And unless
you take everything apart again, performance optimization is n
ot exactly an easy task.

On the other hand, Symfony 2.0 was conceived from the start to be fast and to favor
performance. By way of comparison, Symfony 2.0 is about 3 times faster than Version 1.4
or than Zend Framework 1.10, while taking up 2 times less m
emory.



2. Unlimited flexibility

Whatever your needs are, Symfony 2.0 will be adaptable. Its dependency injector and the
Event Dispatcher make it entirely configurable, with each of the bricks being fully
independent. A 3
-
in
-
1 framework, of sorts:

1.

Full
Stack (complete version): you want to develop a complex application and you need
many functionalities.

2.

Brick by brick: you build your framework according to the functionalities that you will
need.

3.

Microframework: as a standalone, Symfony 2.0 can also be us
ed to develop a specific
functionality in one of your projects. Without having to redevelop everything and without
installing the entire framework, but only the specific brick that you need.

Permanence is also something that relates to long
-
term support. T
oday, this support is
naturally provided by Sensio. But there is also an entire ecosystem that has grown up
around Symfony since its launch: the community (mailing lists, IRC, etc.) and the many
other service companies that have invested in the framework.

Lastly, it is also with a view towards sustainable development that Symfony is distributed
under Open Source MIT license, which does not impose constraints and allows the
development of Open Source as well as proprietary applications.



3. Expandable

From the smallest brick to the complete core itself, everything is presented as a “bundle”
(or plug
-
in in Symfony language) in Symfony 2.0. Each bundle is intended to add
functionality to the framework, of course, and each bundle can also be reused in anot
her
project or shared with the rest of the community.


In any case, the system of bundles allows everything to change within Symfony, including
the core itself. Using the system’s interface contracts between bricks, the behavior of the
framework thus can b
e changed at will, without requiring complete reconfiguration.



4. Stable and sustainable

Developed by Sensio Labs, major versions of Symfony

are all supported for 3 years by the
company. And even for life as far as security
-
related issues are concerned.


For even greater stability, the minor versions of Symfony 2.0’s contract and interface are
also guaranteed and compatibility between all mino
r versions will be ensured on the API
defined by the public interfaces.



5. The joy of developing

As a highly functional environment, Symfony 2.0 also guarantees a certain comfort level for
developers. By taking care of a number of unpleasant tasks (dev
elopment of minor
functionalities, for example), Symfony 2.0 allows developers to focus on the actual
highlights of an application and to both fully validate their role and improve their
productivity.


Among Symfony’s tools designed to make the life of a d
eveloper much easier, there is the
legendary Web Debug Toolbar, as well as native support for development environments,
detailed error pages or even native security.



6. Ease of use

Completely flexible to satisfy the needs of professionals and advanced
users alike, Symfony
2.0 is also very accessible. Plentiful documentation, community and professional support,
and “embedded” best practices within the framework (best practices that are natively
applied without having to be aware of them or understanding
them) allow a beginner to
very quickly feel at ease with Symfony.



Choosing Symfony means having a long
-
term vision of application assets. It also
means knowing how to make the day
-
to
-
day life of developers much easier.

10 criteria for choosing the
correct
framework

You're making progress and that's a good thing! You already know that you
are going to use a framework to develop your site or your application. But
which one? Here is a checklist that you can use to avoid making a mistake:


1. Popularit
y and community size

The more well
-
known and recognized the framework is, the more it will be “living,”
evolving and complete: new ideas, the number and quality of plug
-
ins, etc.


2. Philosophy

This is the very essence of the framework: it is a fundamenta
l criterion for ensuring that it
will meet your needs. A tool developed by professionals for their own needs will obviously
meet the demands of other professionals.


3. Sustainability

Before choosing a framework, make sure that it will be able to keep up
with you for the
duration. This simplifies both the maintenance and upgrading of your applications.


4. Support

Another criterion that should not be overlooked is the ease of finding answers to your
questions and getting help. Identify the support that is

available: from the publisher. From
a community (mailing lists, IRC, etc.)? From Service Companies (development, support,
training)?


5. Technique

To avoid becoming trapped in a labyrinth, it is always preferable to choose an
interoperable solution; one
that respects best practices in terms of development (
design
patterns
)


6. Security

Any application is potentially vulnerable. To minimize risk, it is always better to select a
framework capable of ensuring security functions (XSS management, for example)
.


7. Documentation

It is an absolute necessity to evaluating the nature, volume and quality of existing literature
about a framework: a well
-
documented tool is both easier to use and more upgradeable.


8. License

Licenses are important simply because
they can have a significant impact on your
applications. For example, an application developed using a GPL
-
licensed framework will
necessarily be subject to GPL. On the other hand, this is not the case for an MIT
-
licensed
framework.


9. Availability of re
sources on the market

Perhaps you would want to have a technical team surround you during the development
phase or in the longer term, for both maintenance and upgrades. In other words, make
sure that the skills required for the tool that you are using are

available on the open
market.


10. Try it out!

That's the key! Don't be satisfied with reading reviews, comments and rumors, good or
bad, on the Internet. By testing it out, you will be able to make up your own mind and
ensure that you are completely com
fortable with the tool.



Choosing a framework must not be taken lightly; it is a long
-
term commitment.
Make sure that you make the right selection!