Skip to content

Application

John Aldrich Bernardo edited this page Feb 14, 2018 · 5 revisions

Creating a new Calf Application

Calf Application is just a wrapper for everything in Calf. The only difference is just it gives the Saddle (Dependency Container) to the route you have provided.

<?php

require_once('vendor/autoload.php');

// Create a new Saddle (Dependency Injector)
$container = new \Calf\Saddle();

// More examples for our Saddle
$container->products = [
    'supplies'  => ['Pen'],
    'fruits'    => ['Apple', 'Pineapple']
];

$container->getProducts = function(\Calf\Saddle $c) {
    return $c->products;
};
// Let's instantiate our application
$app = new \Calf\App($container);

Clone this wiki locally