A skeleton to get started with Silex

Overview

Silex Skeleton

WARNING: Silex is in maintenance mode only. Ends of life is set to June 2018. Read more on Symfony's blog.

Welcome to the Silex Skeleton - a fully-functional Silex application that you can use as the skeleton for your new applications.

This document contains information on how to start using the Silex Skeleton.

Creating a Silex Application

Silex uses Composer to ease the creation of a new project:

$ composer create-project fabpot/silex-skeleton path/to/install "~2.0"

Composer will create a new Silex project under the path/to/install directory.

Browsing the Demo Application

Congratulations! You're now ready to use Silex.

To see a real-live Silex page in action, start the PHP built-in web server with command:

$ cd path/to/install
$ COMPOSER_PROCESS_TIMEOUT=0 composer run

Then, browse to http://localhost:8888/index_dev.php/

Getting started with Silex

This distribution is meant to be the starting point for your Silex applications.

A great way to start learning Silex is via the Documentation, which will take you through all the features of Silex.

What's inside?

The Silex Skeleton is configured with the following service providers:

  • ValidatorServiceProvider - Provides a service for validating data. It is most useful when used with the FormServiceProvider, but can also be used standalone.
  • ServiceControllerServiceProvider - As your Silex application grows, you may wish to begin organizing your controllers in a more formal fashion. Silex can use controller classes out of the box, but with a bit of work, your controllers can be created as services, giving you the full power of dependency injection and lazy loading.
  • TwigServiceProvider - Provides integration with the Twig template engine.
  • WebProfilerServiceProvider - Enable the Symfony web debug toolbar and the Symfony profiler in your Silex application when developing.
  • MonologServiceProvider - Enable logging in the development environment.

Read the Providers documentation for more details about Silex Service Providers.

Enjoy!

Comments
  • Page not Found

    Page not Found

    Hello,

    I have just cloned this project to understand how the profiler works, but when I try to access the 'index_dev.php' page I get an HTTP 404 error with a dialog box asking if I want to open the profiler.

    It then takes me to a another page and it states that 'Page not found'.

    I had to create a 'main.css' page as that was missing, but that has not fixed the problem. I can see that lots of files are being created in the /var/cache directory but I do not see the toolbar or any useful information.

    I am sure I am missing something obvious.

    thanks, Russell

    opened by russellseymour 12
  • ClassNotFoundException in Logger.php line 23

    ClassNotFoundException in Logger.php line 23

    Currently, running "composer create-project fabpot/silex-skeleton skeleton" yields;

    ClassNotFoundException in Logger.php line 23:

    Attempted to load interface "LoggerInterface" from namespace "Symfony\Component\HttpKernel\Log". Did you forget a "use" statement for "Psr\Log\LoggerInterface"?

    Logger implements LoggerInterface and DebugLoggerInterface from Symfony\Component\HttpKernel

    symfony/http-kernel (v3.0.0) is installed by default and does not contain LoggerInterface. Explicitly requiring symfony/http-kernel (v2.8.0) resolves the issue.

    opened by CodyBohn 11
  • Method

    Method "request" for object "Silex\Application" does not exist

    Hey

    Every time I try to use something like: {{ app.request.basepath }} in my twig templates.

    I get this error: Method "request" for object "Silex\Application" does not exist in ...

    How to fix this?

    Thanks

    opened by m-vdv 6
  • Providers implements Pimple\ServiceProviderInterface instead of Silex\ServiceProviderInterface as stated in the documentation.

    Providers implements Pimple\ServiceProviderInterface instead of Silex\ServiceProviderInterface as stated in the documentation.

    Hi,

    I'm trying to add a provider to my silex application, but I'm facing an issue.

    I installed my project this way : composer create-project fabpot/silex-skeleton silex-skeleton ~2.0@dev

    By reading the documentation, it says "Providers must implement the Silex\ServiceProviderInterface:" But the ServiceProviderInterface is located in the Pimple vendor. Looking at the providers ready for use, they implement Pimple\ServiceProviderInterface;

    What am i missing? Can this skeleton be used as a normal silex application or are there some specificities?

    Thanks

    opened by Ovski4 5
  • E_NOT_MICROFRAMEWORK?

    E_NOT_MICROFRAMEWORK?

    Not to be too pushy, but doesn't this kind of approach pretty much defeat the point of using Silex at all?

    Just a question to understand why the need for this skeleton: result of the discussion should probably land in README.md

    opened by Ocramius 4
  • Allow to access to asset files on built-in server environment

    Allow to access to asset files on built-in server environment

    On built-in server environment, we cannot access to asset files because web/index_dev.php handles any requests including access to assets. This PR fix this problem.

    refs. http://php.net/manual/en/features.commandline.webserver.php#example-433

    opened by ttskch 3
  • added package http-kernel to fix the logger interface problem

    added package http-kernel to fix the logger interface problem

    fix the following exception after setting up:

    ClassNotFoundException in Logger.php line 23:
    
    Attempted to load interface "LoggerInterface" from namespace "Symfony\Component\HttpKernel\Log".
    Did you forget a "use" statement for "Psr\Log\LoggerInterface"?
    
    opened by vikbert 3
  • Where is the

    Where is the "2.0.x-dev" branch?

    Some code was merged in the "2.0.x-dev" branch, but I can't find it now. Deleted?

    i.e: https://github.com/silexphp/Silex-Skeleton/commit/d129ef4e4b32ff93cd80907fa413a586a213d142

    opened by ArnaudLigny 3
  • Getting the skeleton with composer giver an error

    Getting the skeleton with composer giver an error

    Hello,

    When I try to get the Silex-Skeleton with composer as instructed in the description:

    ./composer.phar create-project Silex-Skeleton-1.1/ myapplication/

    The following error message is given:

    [InvalidArgumentException]
    Could not find package silex-skeleton-1.1/ with stability stable.

    Moreover the the file composer.json does not seem to date

    Can you help me please ?

    opened by babdellhamid 3
  • Error in SecurityServiceProvider after the last update.

    Error in SecurityServiceProvider after the last update.

    This error occurs after the last update.

    ContextErrorException in ContextListener.php line 42:
    
    Catchable Fatal Error: Argument 1 passed to Symfony\Component\Security\Http\Firewall\ContextListener::__construct() must be an instance of Symfony\Component\Security\Core\SecurityContextInterface, instance of Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage given, called in /server/vendor/silex/silex/src/Silex/Provider/SecurityServiceProvider.php on line 359 and defined
    

    Do you need to update the configuration of the provider?

    opened by iBet7o 3
  • Fixing the The function

    Fixing the The function "render" does not exist

    Registering the HttpFragmentServiceProvider, as suggested by @GawainLynch here: https://github.com/silexphp/Silex-WebProfiler/issues/67#issuecomment-109202793.

    Fixing issue #49

    opened by wcomnisky 2
  • what's the intended way to configure service providers?

    what's the intended way to configure service providers?

    I just started moving a prototype app from Slim to Silex, and I started with this skeleton. It seems strange to load config after initializing the app, though. How are you supposed to configure service providers, Monolog for example, with this layout?

    opened by jdmcalee 2
  • phpunit failed

    phpunit failed

    I tried to run phpunit . from the root of this code ( /home/aldo/projects/university/apps/rest-server/silex/) but i got this error: PHP Fatal error: Class 'Monolog\TestCase' not found in /home/aldo/projects/university/apps/rest-server/silex/vendor/monolog/monolog/tests/Monolog/Formatter/FlowdockFormatterTest.php on line 18 here is my conf

    <?xml version="1.0" encoding="UTF-8"?>
    
    <phpunit
        backupGlobals               = "false"
        backupStaticAttributes      = "false"
        colors                      = "true"
        convertErrorsToExceptions   = "true"
        convertNoticesToExceptions  = "true"
        convertWarningsToExceptions = "true"
        processIsolation            = "false"
        stopOnFailure               = "false"
        syntaxCheck                 = "false"
        bootstrap                   = "vendor/autoload.php">
    
        <testsuites>
            <testsuite name="Test Suite">
                <directory>src/</directory>
                <directory>tests/</directory>
            </testsuite>
        </testsuites>
    
    </phpunit>
    
    
    opened by araneta 0
  • fixed loading debug toolbar

    fixed loading debug toolbar

    Fixes "An error occurred while loading the web debug toolbar (500: Internal Server Error)." by changing the twig-bridge version as suggested by @bastien-g (https://github.com/silexphp/Silex-Skeleton/issues/69#issuecomment-270605479).

    Resolves #69

    Note: committing the composer.lock file as the Composer documentation suggests would also prevent others from not experiencing issues due to differences in dependency versions.

    opened by jbmoelker 0
  • Warning: strtr() expects parameter 1 to be string, object given

    Warning: strtr() expects parameter 1 to be string, object given

    Hi,

    I've downloaded the skeleton and when I go on the index, I have this error: [2016-12-03 18:16:20] app.CRITICAL: Twig_Error_Runtime: An exception has been thrown during the rendering of a template ("Warning: strtr() expects parameter 1 to be string, object given") in "@WebProfiler/Collector/request.html.twig" at line 271. (uncaught exception) at C:\wamp\www\sv\vendor\twig\twig\lib\Twig\Template.php line 222 {"exception":"[object] (Twig_Error_Runtime(code: 0): An exception has been thrown during the rendering of a template (\"Warning: strtr() expects parameter 1 to be string, object given\") in \"@WebProfiler/Collector/request.html.twig\" at line 271. at C:\\wamp\\www\\sv\\vendor\\twig\\twig\\lib\\Twig\\Template.php:222, Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Warning: strtr() expects parameter 1 to be string, object given at C:\\wamp\\www\\sv\\vendor\\symfony\\twig-bridge\\Extension\\CodeExtension.php:197)"} []

    I am on Windows 10, php 7.x Do you have any idea how to fix it please?

    Thanks.

    opened by Kingyo 5
  • Update code and Readme about included Providers

    Update code and Readme about included Providers

    From the initial README.rst the ValidatorServiceProvider was missing, and there were already included providers like: HttpFragmentServiceProvider and AssetServiceProvider which where not specified in README.rst

    opened by mhitza 0
Owner
Silex
Silex
Mako skeleton application.

Mako Framework Mako is a lightweight and easy to use PHP framework based on the MVC architectural design pattern. Check out the documentation and crea

Mako Framework 27 Nov 12, 2022
🎁 Datagrid component project skeleton based on Nette Framework

?? Datagrid component project skeleton based on Nette Framework

Contributte 4 Dec 14, 2022
Slim 3 skeleton working with Google App Engine include cron configuration.

Slim3 GAE Skeleton Slim 3 skeleton working with Google App Engine include cron configuration. Demo https://slim3-gae-skeleton.appspot.com/health_check

Jared Chu 2 May 10, 2018
lumen ^6.0 skeleton

Lumen skeleton It can format code and check the error code when submit code. Use the best api response package of QeeZer/api-responder. Comprehensive

齐子 1 Apr 1, 2022
Slim Framework skeleton application with MVC Schema

Slim Framework skeleton application with MVC Schema

JingwenTian 9 Apr 29, 2021
The Yaf testable skeleton and composer supported.

The Yaf testable skeleton and composer supported

安正超 142 Nov 28, 2022
Slim Framework 3 Skeleton Application + PagSeguro Lib

Slim Framework 3 Skeleton Application + PagSeguro Lib Aplicação simples para geração do Token para pagamentos no PagSeguro (método transparente) e env

Raí Siqueira 1 Feb 26, 2018
Slim 3 MVC Skeleton With Swoole

Slim 3 MVC Skeleton With Swoole ##Features Quickly setup and start working on a new Slim Framework 3 . Use the latest Slim 3 with the PHP-View templat

kcloze 53 Aug 17, 2022
MaxPHP HTTP project skeleton.

轻量 • 简单 • 快速 一款基于swoole的组件化的轻量PHP框架,可以用作API开发,方便快速。 主要特性 组件和框架核心分离 基于 Psr7 的 HTTP-Message 基于 Psr11 的容器 基于 Psr14 的事件 基于 Psr15 的中间件 基于 Psr16 的缓存组件,支持 Fi

chengyao 9 Dec 15, 2022
This publication describes a standard filesystem skeleton suitable for all PHP packages

pds/skeleton This publication describes a standard filesystem skeleton suitable for all PHP packages. Please see https://github.com/php-pds/skeleton_r

null 2k Dec 30, 2022
Easy to use, fast extendable small PHP Framework, like the one you ever missed. The skeleton-APP

About Tufu-Framework Easy to use, fast extendable PHP Framework, like the one you ever missed. Features included such as: Twig and extensions. Fast ro

Giacomo Barbalinardo 0 Jul 2, 2022
A skeleton repository for Spatie's PHP Packages

:package_description This package can be used as to scaffold a framework agnostic package. Follow these steps to get started: Press the "Use template"

Spatie 335 Dec 25, 2022
A skeleton to get started with Silex

Silex Skeleton WARNING: Silex is in maintenance mode only. Ends of life is set to June 2018. Read more on Symfony's blog. Welcome to the Silex Skeleto

Silex 789 Dec 5, 2022
Get started with Laravel 5.3 and AngularJS (material)

Laravel 5.3 Angular Material Starter Demo An online demo is available. Angular (2+) update While this starter used to be an excellent starting point f

Jad Joubran 1.7k Dec 14, 2022
Bedrock is a modern WordPress stack that helps you get started with the best development tools and project structure.

WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure

Roots 5.7k Jan 9, 2023
Get started with the Microsoft Graph SDK for PHP

If you want to play around with the PHP library, you can get up and running quickly with the PHP Connect Sample. This sample will start you with a little Laravel project that helps you with registration, authentication, and making a simple call to the service.

Microsoft Graph 423 Dec 28, 2022
Provides a clean and simple way to configure the WordPress-bundled PHPMailer library, allowing you to quickly get started sending mail through a local or cloud based service of your choice

WP PHPMailer provides a clean and simple way to configure the WordPress-bundled PHPMailer library, allowing you to quickly get started sending mail through a local or cloud based service of your choice.

Itineris Limited 61 Dec 6, 2022
Get started using SELCOM APIs with Laravel framework

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Bruno 2 Jan 13, 2022
An all-in-one package with the minimum third-party requirements to get started as quickly as possible with Pokemod Atlas

Pokemod Atlas All-In-One An all-in-one package with the minimum third-party requirements to get started as quickly as possible with Pokemod Atlas. ❤️

Pokemod 12 Oct 10, 2022
This template should help get you started developing with laravel 9 + Vue 3 in Vite + Tailwind

simple-project This template should help get you started developing with laravel 9 + Vue 3 in Vite + Tailwind

Yemeni Open Source 4 Oct 5, 2022