📜 ⬆️ ⬇️

EZ Components 2008.1 released

Today, after running the release candidate , the official release of eZ Components 2008.1 has been released . I will not retell the changelog, I will try to make a brief introduction to eZ Components.

So, eZ Components is a high-quality object-oriented web framework written in PHP5, distributed under the New BSD License . About him already wrote on Habré. This version requires PHP> = 5.2.1

Unlike frameworks offering their own MVC implementation, ezc leaves it to the developer. Good or bad - a difficult question, but I like this approach. In general, it must be said that ezc is a fairly democratic framework that allows you to use only what you want quite naturally.
')
In addition to the modules present in all imaginable frameworks (abstract layer to the database, search, work with mail and RSS), there are quite interesting components. For example, plotting graphs:

Image Hosted by ImageShack.us

As a result, the following schedule will be generated:



There is also an interesting component for various image transformations. Here is an example from a real project: you need to process a list of graphic files of arbitrary type (jpeg, gif, png), and create for each thumbnail for the list of products in jpeg, thumbnail for the product card in jpeg, and simply convert the source file to jpeg. The basic idea is that you first need to create a converter and prepare named transformations:

Image Hosted by ImageShack.us

We got a converter object with which we can work anywhere. As a rule, similar transformations are used within a single project. Note that the second parameter of the createTransformation () method is an array of filters. In this example, we used a single filter for the transformation, but in general there can be as many filters as possible. For example, the second filter in the transformations we could add the imposition of a "watermark" with the logo of the organization.

So, the converter is created, now we can by name cause transformations which it encapsulates:

Image Hosted by ImageShack.us

Please note that if we want to change the transformations, for example, add the same “watermark”, or change the size or quality of the target images - we just need to adjust the converter differently, the code in the loop does not need to be changed. In the cycle, minimal actions occur in general, everything else is taken out of its limits.

I will not list the remaining components, there are quite a few of them. Read the documentation, I think everyone will find something interesting for themselves.

Now a little about how to start using all these goodies. First you need to get and install ezc. This is described in great detail in the Installation Guide . Please note that the version installed through pear and the download version differ significantly. Downloading includes, in addition to the code, accompanying documentation (including tests and UML diagrams in graphics, which in itself is a matter of respect), weighs a lot. Pear-version includes only the working code and weighs only 7.7 Mb.

Of course, someone will say that 8 Mb is a lot. Maybe. But that which is not used simply lies in the FS and, as they say, “does not ask for bread.” If you are really annoyed with such a size, you can install only necessary components. I use the complete pear installation.

After the desired distribution is in the right place, you need to prepare the __autoload () function (why it’s necessary, and whether it’s necessary at all - another question). The naming scheme of files in ezc, in contrast, for example, to the Zend Framework, is rather complicated and opaque. Therefore, if you want the convenience of __autoload (), then you need to use the standard method from ezc Base. Roughly speaking, there is no other conceivable way (the file name is taken from sufficiently large arrays of the form 'class' => 'file_name').

Here is an example from a real project. Here, in addition to ezc, the Zend Framework is used. Files of the application itself are named in the style of ZF. Notice how easy it is to cling to classes outside of ezc (after all, I like the ZF naming scheme more). The LIBRARY_PATH path must be present in INCLUDE_PATH: set_include_path (LIBRARY_PATH), in this example there are two folders: Zend and ezc.

Image Hosted by ImageShack.us

That's all. I wish you all more business logic and a smaller invention of bicycles;)

Source: https://habr.com/ru/post/27437/


All Articles