Service Container and Dependency Injection in Symfony framework

Sometimes a single idea can change everything about programming. For me, one of those ideas was the concept of a service container. It's like the holy grail). Actually, the idea itself is not specific to Symfony framework, it's just one of the successful patterns of application design often used in Symfony.

Collection Bundle

Aside from the standard Symfony distribution, there are many bundles from third-party developers that greatly simplify application development (after all, why reinvent the wheel when there is a ready-made solution available). Let's not get into a debate about the often presence of functionality in bundles that will never be used in your application—development speed will cover these fairly minor issues. Here is a modest collection of bundles that greatly simplify life.

To install a bundle, first add it to your project using composer, for example:

composer require "presta/sitemap-bundle:~1.4"

Usage of Composer

Composer - a dependency manager, or rather, a package manager for php.

Official website:

Allows you to keep track of components used in a php application, install them, update them, etc.

Doctrine. Structure. Entity

Right after starting to work with Doctrine I acquired some prejudices. I have since eradicated them, but maybe someone still has them, maybe this note will help someone =)

Wordpress. Introduction. (Lesson 1)

It's time to deal with Wordpress. Personally, I've been using it for quite a while, but only as a user/administrator, with a little half-intuitive tweaking of some missing functionality for me personally. But now it's time to go deeper.

Using assetic in the Symfony framework

A few notes back I considered working with assets in the Symfony framework. This example shows how to work with your own assets. But in practice, it is often necessary to use external assets.

For such, and not only such tasks, assetic is suitable. It is quite difficult to describe in a few words what it is. But I imagine assetic as an asset manager for myself.

Working with databases in PHP. MySQL module

If before (before php 5.0) it was possible to use a more or less trivial way of working with databases in php (using the MySQL module), then with new versions of php it is necessary to switch to new modules, such as mysqli or pdo. The MySQL module is deprecated in php 5.5.x and will soon be completely excluded.

In this note we will remind you how to use the MySQL module, but use modern interfaces for work (see the next notes). To use the minimum functionality of the MySQL module you only need to remember a few functions (of course, there are many more of them, here only the necessary minimum is presented).

Creating websites

As of 2012, there were 612,843,429 websites on the Internet. This number is rapidly growing.

So why do people create websites?

Authentication, identification, and authorization

Quite an important task in the development of websites and web applications is restricting access to certain sections of the site, such as the admin panel. In theory, this is a rather complex process, consisting of three components - authentication, identification, and authorization.

Forms in Symfony framework. Data from multiple tables. (Lesson 13. Forms. Continued)

In the previous lesson, we learned how to create simple forms in Symfony framework that contain (and modify if necessary) data from tables. As you remember, we used models (entities) of these tables.

But in practice, we have to solve more complex tasks. For example, displaying/modifying data from multiple tables in Symfony framework.

A rough example - one table contains articles, and there is a field that sets the section id (which has a separate table). We need to make it possible to conveniently select a section for an article. Fortunately, this is a routine task for Symfony framework. =)

Working with forms in Symfony framework (Lesson 12. Forms. Introduction)

In this note we will learn how to create and handle forms in Symfony framework.

Forms can be created "from scratch" or using an ORM (object-relational mapping) to generate forms based on database tables. Let's start by exploring the second option. In practice, these types of forms are most commonly encountered since in most cases, the data entered in the form needs to be stored somewhere (in a database).

Placement of a project on the Symfony framework on the server

As you know from the lessons, the public directory of Symfony framework by default is web/, and the framework directories lie next to it. This means that for normal operation and pretty URLs, the DocumentRoot on the server should be set specifically to the web/ folder. But this is not always convenient and not always possible on hosting. In most cases, you will not have the ability to edit the DocumentRoot.