PHPackages                             cocoon-projet/template - 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. [Templating &amp; Views](/categories/templating)
4. /
5. cocoon-projet/template

ActiveLibrary[Templating &amp; Views](/categories/templating)

cocoon-projet/template
======================

Un moteur de template pour le language php

0.0.3(1y ago)08MITPHPPHP ^8.0CI passing

Since Oct 23Pushed 1y ago1 watchersCompare

[ Source](https://github.com/cocoon-projet/template)[ Packagist](https://packagist.org/packages/cocoon-projet/template)[ Docs](https://github.com/cocoon-projet/template)[ RSS](/packages/cocoon-projet-template/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (4)Used By (0)

[![PHP Composer](https://github.com/cocoon-projet/template/actions/workflows/ci.yml/badge.svg)](https://github.com/cocoon-projet/template/actions/workflows/ci.yml)[![License](https://camo.githubusercontent.com/bbd05f341c8cc2fef766a381c121830e990070db1c11179202f86be4fbfae318/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e63652d4d49542d677265656e)](https://camo.githubusercontent.com/bbd05f341c8cc2fef766a381c121830e990070db1c11179202f86be4fbfae318/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e63652d4d49542d677265656e) [![codecov](https://camo.githubusercontent.com/7b15bcaa052dfaefc973b41026189e9b00ab2b940e18e45e44e4f3d50049b65d/68747470733a2f2f636f6465636f762e696f2f67682f636f636f6f6e2d70726f6a65742f74656d706c6174652f67726170682f62616467652e7376673f746f6b656e3d57524646334530504132)](https://codecov.io/gh/cocoon-projet/template)

Cocoon Template Engine
======================

[](#cocoon-template-engine)

Un moteur de template PHP simple et puissant, inspiré de Twig et Blade.

Pré-requis
----------

[](#pré-requis)

[![PHP Version](https://camo.githubusercontent.com/37e3195032b5c7e4be284eb0942ffe75d7962d9b7aa77fe10ffb7e063392b4c4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068703a76657273696f6e2d382e302d626c7565)](https://camo.githubusercontent.com/37e3195032b5c7e4be284eb0942ffe75d7962d9b7aa77fe10ffb7e063392b4c4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068703a76657273696f6e2d382e302d626c7565)

Installation
------------

[](#installation)

```
composer require cocoon-projet/template
```

Configuration
-------------

[](#configuration)

```
use Cocoon\View\Twide;

Twide::init([
    'views' => 'resources/views',
    'cache' => 'temp/views',
    'extension' => '.tpl.php'
]);
```

Extensions Disponibles
----------------------

[](#extensions-disponibles)

### Extensions par défaut

[](#extensions-par-défaut)

- **TextExtension** : Manipulation de texte
- **DateExtension** : Gestion des dates
- **ArrayExtension** : Manipulation des tableaux

Syntaxe de Base
---------------

[](#syntaxe-de-base)

### Variables

[](#variables)

```
{{ variable }}
{{ user.name }}
{{ numbers[0] }}
```

### Conditions

[](#conditions)

```
@if(condition)
    Contenu
@elseif(autre_condition)
    Contenu alternatif
@else
    Contenu par défaut
@endif
```

### Boucles

[](#boucles)

```
@foreach(items as item)
    {{ item.name }}
@endforeach

@for(i = 0; i < 10; i++)
    {{ i }}
@endfor
```

### Layouts et Sections

[](#layouts-et-sections)

```
@layout('layout')
    @section('content')
        Contenu de la page
    @endsection
@endlayout
```

Extensions
----------

[](#extensions)

### TextExtension

[](#textextension)

```
{{ 'texte'|excerpt(50) }}
{{ 'titre'|slug }}
{{ 'texte'|wordcount }}
{{ 'texte'|str_starts_with('prefix') }}
```

### DateExtension

[](#dateextension)

```
{{ date|timeago }}
{{ date|age }}
{{ date|calendar }}
{{ date|duration }}
{{ is_future(date) }}
{{ is_past(date) }}
```

### ArrayExtension

[](#arrayextension)

```
{{ array|sort('name') }}
{{ array|filter('status', 'active') }}
{{ array|map('id') }}
{{ array|unique }}
{{ array|first }}
{{ array|last }}
```

Licence
-------

[](#licence)

MIT

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance47

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~256 days

Total

3

Last Release

418d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b019cffcdf77ab35448666ea712d4263ae3afd4bc0110de6a267936e3dba08d?d=identicon)[cocoon-projet](/maintainers/cocoon-projet)

---

Top Contributors

[![cocoon-projet](https://avatars.githubusercontent.com/u/28481301?v=4)](https://github.com/cocoon-projet "cocoon-projet (11 commits)")

---

Tags

templatetemplatingviewviews

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/cocoon-projet-template/health.svg)

```
[![Health](https://phpackages.com/badges/cocoon-projet-template/health.svg)](https://phpackages.com/packages/cocoon-projet-template)
```

###  Alternatives

[eftec/bladeone

The standalone version Blade Template Engine from Laravel in a single php file

8208.4M87](/packages/eftec-bladeone)[duncan3dc/blade

Use Laravel Blade templates without the full Laravel framework

160499.5k24](/packages/duncan3dc-blade)[laminas/laminas-view

Fast and type safe HTML templating library with a flexible plugin system supporting multistep template composition

7526.3M230](/packages/laminas-laminas-view)[eftec/bladeonehtml

The standalone version Blade Template Engine from Laravel in a single php file

1018.1k5](/packages/eftec-bladeonehtml)[figdice/figdice

Template Engine, XML-centric and attribute-driven

222.4k1](/packages/figdice-figdice)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
