2017 © Pedro Peláez
 

library silex-base

Base silex application to build upon.

image

andrewjt71/silex-base

Base silex application to build upon.

  • Saturday, July 22, 2017
  • by andrewjt71@gmail.com
  • Repository
  • 1 Watchers
  • 0 Stars
  • 49 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 2 % Grown

The README.md

README

Summary

Base skeleton for a Silex Application, (*1)

Packagist

https://packagist.org/packages/andrewjt71/silex-base, (*2)

Usage

composer require andrewjt71/silex-base

In app/config/config.yml, (*3)

monolog:
    logfile: app/logs/log
twig:
    path:
        - /src/YourProject/views

In src/YourProject/controller, (*4)

<?php

namespace YourProject\Controller;

class FrontController
{
    private $twig;

    function __construct ($twig)
    {
        $this->twig = $twig;
    }

    public function indexAction()
    {
        return $this->twig->render(
            'welcome.html.twig',
            []
        );
    }
}

In src/YourProject/views/base.html.twig, (*5)

<!DOCTYPE html>
<html>
    <head>
        {% block head %}
            <link href='https://fonts.googleapis.com/css?family=Questrial' rel='stylesheet' type='text/css'>
            <link href='https://fonts.googleapis.com/css?family=Fredoka+One' rel='stylesheet' type='text/css'>
            <title>{% block title %}{% endblock %} - My Webpage</title>
        {% endblock %}
    </head>
    <body>
        <div id="content">{% block content %}{% endblock %}</div>
    </body>
</html>

In src/YourProject/views/welcome.html.twig, (*6)

{% extends "base.html.twig" %}

{% block content %}


Welcome
{% endblock %}

In web/index.php, (*7)

<?php

require_once __DIR__.'/../vendor/autoload.php';

use SilexBase\Application;
use YourProject\Controller\FrontController;

$app = new Application();

$app['controller.front_controller'] = $app->share(function() use ($app) {
    return new FrontController($app['twig']);
});

$app->get('/', "controller.front_controller:indexAction");

$app->run();

The Versions

22/07 2017

dev-master

9999999-dev

Base silex application to build upon.

  Sources   Download

proprietary

The Requires

 

by Andrew Taylor

22/07 2017

0.0.7

0.0.7.0

Base silex application to build upon.

  Sources   Download

proprietary

The Requires

 

by Andrew Taylor

21/07 2017

0.0.6

0.0.6.0

Base silex application to build upon.

  Sources   Download

proprietary

The Requires

 

by Andrew Taylor

21/07 2017

0.0.5

0.0.5.0

Base silex application to build upon.

  Sources   Download

proprietary

The Requires

 

by Andrew Taylor

03/03 2017

0.0.4

0.0.4.0

Base silex application to build upon.

  Sources   Download

proprietary

The Requires

 

by Andrew Taylor

16/07 2016

0.0.3

0.0.3.0

Base silex application to build upon.

  Sources   Download

proprietary

The Requires

 

by Andrew Taylor

16/07 2016

0.0.2

0.0.2.0

Base silex application to build upon.

  Sources   Download

proprietary

The Requires

 

by Andrew Taylor

13/04 2016

0.0.1

0.0.1.0

Base silex application to build upon.

  Sources   Download

proprietary

The Requires

 

by Andrew Taylor