What is Symfony?
“Symfony is a set of PHP Components, a Web Application framework, a Philosophy, and a Community — all working together in harmony.” — Symfony
Symfony is a collection of powerful PHP development tools that includes a set of independent components and a full-fledged development framework that rides on top of those components.
What is an Application Framework?
A framework is an integrated collection of tools, templates, and methodologies for developing a software application.
A framework doesn’t just provide a set of independent tools and libraries. Rather, the benefit of a framework is in the integration of all its parts and the overall effect this has on the way you develop an application.
Developers cite a variety of benefits from using Symfony, including efficiency, security, and the ease with which a new developer can get up to speed on an existing project. (Photo by Jefferson Santos via Unsplash).
Benefits of a Framework
Application development frameworks provide:
- Modules for frequently needed application features.
- Tools for speeding up or automating application development tasks.
- Methodologies or implementation patterns for building new features.
- Structure for how to organize code and architectural components.
- Philosophy of how to go about designing, building, and deploying a software application.
Why Should I Use an Application Development Framework?
An application framework allows you to do more while typing less.
Here are some good reasons why you would use it:
- Why re-build the same features, over and over, for every new application?
- Why do things manually when they could be automated?
- Why do analogous tasks in different ways?
- Why build from scratch when most applications are organized on similar principles?
- Why walk alone when a community of developers has gone ahead of you?
A snippet of PHP code from the Laravel framework showing the use of Symfony components. (Via WhoIsHostingThis.com)
The obvious answer to these questions is: You shouldn’t do those things. Using an application development framework helps you avoid those fundamental errors in programming judgment.
It will probably save you a ton of time, too.
What are Symfony’s Core Features?
Symfony is an application development framework for building web applications in PHP. There are several other popular PHP frameworks, so let’s focus on a couple things that really make Symfony stand out.
Understanding the Modular Design of Symfony
Symfony is highly modularized, more so than almost any other similar framework.
It consists of a core set of individual modules which each provide a fairly granular amount of functionality.
These components were designed so that they could be used individually. Indeed, you can add any one of them by itself to a project to get a specific feature benefit.
Key Modules in Symfony
The key modules include:
Mixing and Matching Symfony Modules
These modules each provide a fairly specific set of features to application development. They can be used independently. In fact, they are developed and maintained independently — each individual module has its own GitHub repo.
Taken as a whole, and with added structural components, they create a powerful development framework.
Plugins Give Symfony Additional Functionality
But the modularity doesn’t end with the design of the framework itself. Additional functionality beyond these core modules can be added to the application by plugins.
User management, mail server interaction, CSS preprocessing — all these common applications features, and many others can be added via plugins.
What is Model-View-Controller (MVC) Design?
This structure also encourages application development to be done in a similarly modular way, which promotes code re-use and good programming practices.
A simple diagram of the MVC concept. (Via WhoIsHostingThis.com)
The Symfony PHP framework strongly encourages the model-view-controller (MVC) approach to design.
MVC cleanly separates the user interface from the app’s internal workings, so it’s easy to change the look of a Symfony application without changing everything.
The Symfony development team emphasizes that it isn’t just a set of tools and a framework: it is also a philosophy and a community.
What Does the Symfony Community Offer?
The Symfony community provides an outstanding level of support and documentation, from detailed instructions on how to use each component, to talking points for explaining development frameworks to various stakeholders and decision makers.
This focus on the “soft” aspects of software development promotes a high degree of overall programmer satisfaction and quality of code.
When to use Symfony Hosting
Why would you use Symfony on a hosted system, rather than your own desktop? There are several possible reasons.
You may be working with testers or customers at distant locations. Following a DevOps philosophy, you want them to see changes as you make them.
Your development team may be dispersed over a large area. A hosted site may be the most practical and economical way for them all to work together.
If you use the same site for Symfony work and application hosting, it serves as a staging area where you can make corrections on the fly and then deploy them on the web server.
Your final testing environment is the same as the deployment environment, giving you extra confidence.
The latest major release of Symfony is version 4, which is designed for PHP 7.
If you want to stick with code that runs under PHP 5, Symfony 3 is still supported. There’s no good reason to use older versions.
At a minimum, Symfony requires:
- PHP 5.3.3 or higher (Symfony 3)
- PHP 7.1.3 or higher (Symfony 4)
- JSON enabled
- ctype enabled
- php.ini must have date.timezone setting
Symfony Components and Settings
Other components and settings are highly recommended. Please see the complete Symfony Requirements guide.
Also, applications built on Symfony might additionally require other features, modules, or settings at the server level.
Support for Symfony
Many web hosts already support Symfony, or can be configured to support it.
Be sure that your hosting plan lets you install Symfony and is suitable for development work. You’ll need these capabilities, at a minimum:
- Command-line access.
- The ability to upload files.
- Access to php.ini and other configuration files.
You’ll very likely want to use a remote IDE and debugger, so make sure that your host isn’t firewalled against it. Look for a hosting server with a free trial period, and use the time to verify that your development environment works the way you want.
Shared hosting may be good enough for personal projects.
Core Symfony Features:
- Allows PHP development without having to reinvent common functions
- Strong support community
- Flexible and expandable, thanks to bundle-based architecture
My Choices: Top Symfony Hosts
The number of web hosts out there from which you can choose can be overwhelming, so we recommend the following hosts as a starting point.
Symfony hosting with SiteGround.
SiteGround’s servers support four PHP versions, including the latest version of PHP 7. SSH access to the powerful Bash shell and a staging environment are among SiteGround’s developer-friendly features.
SiteGround consistently exceeds its guaranteed uptime of 99.9%. A 30-day trial period lets you make sure it will meet your needs.
Symfony hosting with Bluehost.
Bluehost lets you choose PHP 5 or 7, and SSH access is available after account verification. Dedicated and VPS servers have root shell access.
You can get a refund for hosting costs, though not associated services such as SSH certificates, in the first 30 days. Support by phone, email, and chat is always available. It’s Linux-only, with no Windows servers.
Symfony hosting with GreenGeeks.
GreenGeeks have clearly earned the “geek” in their name, as their online instructions for using Git source code management prove. All their servers allow SSH access, and they support multiple versions of PHP.
You get a 30-day money-back guarantee and 24/7 live chat and email support. Phone support isn’t available 24 hours a day, though.
Other features in Languages and Frameworks
- .NET Framework
- Ruby on Rails
- Server Side Includes
- PHP 5
- PHP 7
Symfony Frequently Asked Questions
- What is Symfony?
Symfony is a PHP framework designed to speed up web application development.
- Who develops Symfony?
Symfony is developed by SensioLabs, an open-source software company. They are helped by a vast network of community contributors.
- Why are there so many modules?
Modules provide Symfony with flexibility. If you are looking to develop a complex application with multiple functions, you can install the full version of Symfony (the Full Stack). If you have specialized needs, you can pick and choose the functions that you require. Or if you just want to take advantage of one or two features, you don’t need the whole framework. Just use an individual module to enhance your project.
- Can I use Symfony with other PHP frameworks?
Yes. PHP is designed to add to your existing tools, whether that’s simply PHP or PHP and another PHP framework. In fact, because Symfony is a module build, you only need to use the pieces that are appropriate for your application, so you can use it as necessary, and then go back to utilizing your other resources.
- How does Symfony version 3 compare version 4?
The big difference is that Symfony 4 uses PHP 7, and Symfony 3 uses PHP 5. Applications built with Symfony 4 require PHP 7 to run. Version 4 uses a new application structure called Flex. Otherwise, the differences are minor, and moving to version 4 shouldn’t break existing projects.
- When Symfony gets updated, will my code still work?
Symfony is designed so that your code will continue to work, regardless of updates. Updates are built around the existing code and only provide bug fixes, security fixes, or improved functionality. Existing functionality should remain intact. However, you should always review release notes prior to updating, to make sure no existing features or code have been impacted.
- What type of support is available for Symfony?
Community-based support is provided through an online forum, mailing list, and IRC channel. Additionally, a large library of documentation, including user guides, installation guides, and samples are available to assist users. Symfony also offers personalized, paid support for a range of prices.
- Is Symfony training available?
Yes. SensioLabs, the creators of Symfony, offers training courses and certifications in English, French, German, and Spanish. These are offered in several countries around the world. Additionally, there is a large library of documentation available on their site to get you started and to help you master the Symfony framework.
- Can I use Symfony with a shared hosting plan?
Yes, but it is not recommended. Any web application that relies on dynamic content, as in something built with PHP, is going to require more resources than a traditional, publishing-only website. Depending on the level of interaction or the number of visitors you get, this can quickly become too much for a shared plan to handle.
On the other hand, if your interest is simply learning Symfony, a shared hosting plan should work just fine.
- What type of license is Symfony issued under?
Symfony is released under the MIT license. This is very similar to the GNU GPL license, and, in fact, is considered GPL-compatible. It allows users to download, use, modify, and redistribute the source code in any way (even for use in proprietary software), provided the MIT license is distributed with the modified software.
- How can I contribute to Symfony?
Like most open-source software, Symfony welcomes community support. The easiest way to contribute is by submitting a bug report. You can also contribute to their documentation library or write a translation. If you are a developer, you can contribute by submitting a patch, either for a bug or a proposed enhancement. At the time of this writing, they were not accepting new core contributors, but if you are interested, you should check their website to see if this has changed.
- How can I keep my system up-to-date?
Symfony allows you to subscribe to their mailing list to be notified any time an update is available, that way you can always make sure you’re using the latest version.