PHPackages                             sy/component - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. sy/component

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sy/component
============

Build your application as a tree of simpler components

2.5.4(1y ago)01.6k11MITPHPPHP &gt;=5.6.0

Since Sep 28Pushed 1y ago1 watchersCompare

[ Source](https://github.com/syframework/component)[ Packagist](https://packagist.org/packages/sy/component)[ RSS](/packages/sy-component/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (5)Versions (25)Used By (1)

sy/component
============

[](#sycomponent)

The concept of **component** allows you to build an application as a tree of simpler components (Composite design pattern). And each component can be reusable.

Basically we can assume that a component is a stringable object. At this point, it just use a template to generate a string that can be in any format (html, xml, json, plain text etc...). On top of this, we can build web components by adding css and js properties.

The class **Sy\\Component** is the base class of other **web components** ([sy/webcomponent](https://github.com/syframework/webcomponent)) and **html page and elements** ([sy/html](https://github.com/syframework/html)) like form and table etc...

Component template engine
-------------------------

[](#component-template-engine)

The template engine used is [sy/template](https://github.com/syframework/template)

### Template syntax notion: **slot** and **block**

[](#template-syntax-notion-slot-and-block)

Example with **setVar** method for filling a slot, your PHP script:

```
