2017 © Pedro Peláez
 

library cocoon

A simple php view renderer.

image

james-draper/cocoon

A simple php view renderer.

  • Saturday, July 22, 2017
  • by JamesDraper
  • Repository
  • 1 Watchers
  • 1 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Cocoon

A simple php view renderer., (*1)

Requirements

  • Composer
  • PHP 7.1 or greater

Installation

To install Cocoon via composer, run the following command:, (*2)

composer require james-draper/cocoon

Getting started

Here is a simple example of how to render a view, for a more detailed explanation consult the documentation., (*3)

<?php

$factory = new \Cocoon\Factory([__DIR__ . '/views'])
return $factory
    ->create('path/to/template')
    ->setVar('some_var', 123)
    ->setVarRaw('some_other_var', 456)
    ->render();

The above code snippet first creates a factory, uses the factory to creates a view, assigns variables to that view, and then renders the view. Below is what the template file might contain., (*4)

<p>var1: <?php echo $this->some_var; ?></p>
<p>var2: <?php echo $this->some_other_var; ?></p>

The Versions

22/07 2017

dev-master

9999999-dev

A simple php view renderer.

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

21/07 2017

1.0

1.0.0.0

A simple php view renderer.

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires