Приглашаем посетить
Кулинария (cook-lib.ru)

Section 3.2.  Extending PHP

Previous
Table of Contents
Next

3.2. Extending PHP

The base of the PHP language is simple, having just enough to set and retrieve variables, work with loops, and check whether a statement is true or not. The real power behind PHP comes with its extensions add-ons to the base language that give it more flexibility. PHP has hundreds of extensions, which can be broken down into five types: core, bundled, PECL, third party, and DIY.

  • Core extensions are extensions bundled with PHP itself and enabled by default. For all intents and purposes they are part of the base language, because, unless you explicitly disable them (few people do, and sometimes you cannot), they are available inside PHP. For example, the mechanism to handle reading and saving files in PHP is handled by an extension automatically compiled into PHP.

  • Bundled extensions are extensions included with PHP but not enabled by default. They are commonly used, which is why they are included, but they are not available unless you specifically enable them. For example, the mechanism to handle graphics creation and editing is handled by an extension that is bundled with PHP but not enabled by default in php.ini.

  • PECL (pronounced "pickle") stands for "PHP Extension Code Library" and was created as a place where rarely used or dormant extensions could be moved if they were no longer considered relevant to the core PHP distribution. PECL has grown since its founding, and is now the home of many interesting and experimental extensions that are not yet important enough for the mainstream.

  • Third-party extensions are written by programmers who wanted to solve a particular problem that was unsolvable without a new extension. A variety of third-party extensions are available, with the sole difference between a third-party extension and a PECL extension being that there are various rules about submitting code to PECL. Third-party extensions can sometimes be unstable.

  • Finally, Do-It-Yourself (DIY) extensions are simply extensions you create yourself. PHP has a rich extension creation system that makes it simple to add your own code, as long as you are proficient in C. Note that creating your own extension requires that you have the ability to compile PHP.


Previous
Table of Contents
Next