Giter Site home page Giter Site logo

silex-kitchen-edition's Introduction

Silex - Kitchen Sink Edition

WARNING: Since silex is deprecated, this repository have been archived.

This project is a sample or a bootstrap silex application. You can use it for your next PHP application.

Installation

git clone https://github.com/lyrixx/Silex-Kitchen-Edition
cd Silex-Kitchen-Edition
composer install
npm install

bin/console doctrine:database:create
bin/console doctrine:schema:load
bin/console fixture:load

silex-kitchen-edition's People

Contributors

bacardi55 avatar bassettsj avatar catchamonkey avatar ifdattic avatar igorw avatar karl007 avatar lyrixx avatar ronanguilloux avatar sgrodzicki avatar smaftoul avatar stof avatar tacone avatar tamcy avatar toleillo avatar tomadam avatar trismegiste avatar tucksaun avatar umpirsky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

silex-kitchen-edition's Issues

The option "validation_constraint" does not exist

I followed https://github.com/lyrixx/Silex-Kitchen-Edition/blob/master/src/controllers.php#L27 and I got:

'Symfony\Component\Form\Exception\CreationException' with message 'The option "validation_constraint" does not exist. Known options are: "data", "data_class", "trim", "required", "read_only", "disabled", "max_length", "pattern", "property_path", "by_reference", "error_bubbling", "error_mapping", "label", "attr", "invalid_message", "invalid_message_parameters", "translation_domain", "empty_data", "virtual", "csrf_protection", "csrf_field_name", "csrf_provider", "intention"'

AsseticExtension is slow

Regarding:

But not with auto_dump_assets. With this setting, application is really slower (from 300ms to 700ms). Do you know why ? what does this setting do ?

from #20

I just tested again, with current master, it takes 600-700ms to load a page. When you remove $app->register(new AsseticExtension()... it drops to 100-200ms.

Looks like there is something wrong with AsseticExtension.

Bootstrap implementation

Currently, although there is a dependency, Bootstrap files exist in the resources folder. I'd like to suggest that lessphp is added to the Composer dependencies and the lessphp filter is added to the Assetic configuration. Then a LESS file could be created in the resources that includes Bootstrap, would allow for customisation of Bootstrap using less variables - much nicer than attempting to change the already compiled CSS.

While trialling the second solution, I installed lessphp and enabled the filter for Assetic. Unfortunately I am getting a compilation error as there is a bug in the LESS of Bootstrap 1.4.0, so I have switched up to 2.0.2. This brings on my second question. I assume the reason for using Bootstrap 1.4.0 is that it was the current version when this project was started. Would you be against moving on to 2.x?

If you are interested I will create a pull request with the changes required to implement lessphp and the Assetic filter, along with a switch to Bootstrap 2.0.2, and the changes to the views required to support it. I'm not going to be able to do this until next week however.

debug=true produces ProfilerListener::__construct() fatal error

I did a fresh install of Kitchen-Edition. The pertinent installed packages for this error are as follows:

silex/silex                 v1.3.4  The PHP micro-framework based on the Symfony Components
silex/web-profiler          v1.0.7  A WebProfiler for Silex
symfony/http-kernel         v3.0.0  Symfony HttpKernel Component
symfony/http-foundation     v3.0.0  Symfony HttpFoundation Component
symfony/web-profiler-bundle v2.8.0  Symfony WebProfilerBundle

If you enable debug, it throws this fatal error: Catchable fatal error: Argument 2 passed to Symfony\Component\HttpKernel\EventListener\ProfilerListener::__construct() must be an instance of Symfony\Component\HttpFoundation\RequestStack, null given, called in \ske\vendor\silex\web-profiler\Silex\Provider\WebProfilerServiceProvider.php on line 184 and defined in \ske\vendor\symfony\http-kernel\EventListener\ProfilerListener.php on line 48

It appears to be a combination of mismatched package installs. I found that the errored call is indeed fixed in 2.0-dev of silex/web-profiler, however, if you include it, it wants to also include silex/silex 2.0. Rather than go down that alley, I cobbled something together. It's a minor change, so I did the following to temporarily correct it.

Changed ...\vendor\silex\web-profiler\Silex\Provider\WebProfilerServiceProvider.php

// HTTPKernel 3.0 changed the ProfileListener constructor.  This is fixed in 
// Silex-WebProfiler/WebProfilerServiceProvider.php v2.0, but it requires 
// Silex/Silex 2.0 as well.  I'm running 1.3.4
//
        $app['profiler.listener'] = $app->share(function ($app) {
            return new ProfilerListener(
                $app['profiler'], 
                $app['request_stack'], 
                $app['profiler.request_matcher'], 
                $app['profiler.only_exceptions'], 
                $app['profiler.only_master_requests']
             );
        });
//        
/*  Commented out this older ProfilerListener constructor call
        $app['profiler.listener'] = $app->share(function ($app) {
            return new ProfilerListener(
                $app['profiler'],
                $app['profiler.request_matcher'],
                $app['profiler.only_exceptions'],
                $app['profiler.only_master_requests'],
                $app['request_stack']
            );
        });
 */

It now works. Hopefully there is a better solution.

WebDebugToolbarListener Exception after running composer update

Hello,

I've just run composer update, which updated several components, and now the WebDebugToolbar is throwing an exception.

Here is the list of updates composer did:
Loading composer repositories with package information
Updating dependencies (including require-dev)

  • Removing twig/twig (v1.14.2)
  • Installing twig/twig (v1.15.0)
    Downloading: 100%
  • Removing symfony/intl (v2.3.7)
  • Installing symfony/intl (v2.4.0)
    Downloading: 100%
  • Removing symfony/filesystem (v2.3.7)
  • Installing symfony/filesystem (v2.4.0)
    Downloading: 100%
  • Removing symfony/config (v2.3.7)
  • Installing symfony/config (v2.4.0)
    Downloading: 100%
  • Removing symfony/console (v2.3.7)
  • Installing symfony/console (v2.4.0)
    Downloading: 100%
  • Removing symfony/property-access (v2.3.7)
  • Installing symfony/property-access (v2.4.0)
    Downloading: 100%
  • Removing symfony/options-resolver (v2.3.7)
  • Installing symfony/options-resolver (v2.4.0)
    Downloading: 100%
  • Removing symfony/form (v2.3.7)
  • Installing symfony/form (v2.4.0)
    Downloading: 100%
  • Removing symfony/finder (v2.3.7)
  • Installing symfony/finder (v2.4.0)
    Downloading: 100%
  • Removing symfony/translation (v2.3.7)
  • Installing symfony/translation (v2.4.0)
    Downloading: 100%
  • Removing symfony/validator (v2.3.7)
  • Installing symfony/validator (v2.4.0)
    Downloading: 100%
  • Removing symfony/yaml (v2.3.7)
  • Installing symfony/yaml (v2.4.0)
    Downloading: 100%
  • Removing symfony/dom-crawler (v2.3.7)
  • Installing symfony/dom-crawler (v2.4.0)
    Downloading: 100%
  • Removing symfony/browser-kit (v2.3.7)
  • Installing symfony/browser-kit (v2.4.0)
    Downloading: 100%
  • Removing symfony/css-selector (v2.3.7)
  • Installing symfony/css-selector (v2.4.0)
    Downloading: 100%
  • Removing symfony/stopwatch (v2.3.7)
  • Installing symfony/stopwatch (v2.4.0)
    Downloading: 100%
  • Installing symfony/security-core (v2.4.0)
    Downloading: 100%
  • Removing symfony/debug (v2.3.7)
  • Installing symfony/debug (v2.4.0)
    Downloading: 100%
  • Installing symfony/security-csrf (v2.4.0)
    Downloading: 100%
  • Removing symfony/twig-bridge (v2.3.7)
  • Installing symfony/twig-bridge (v2.4.0)
    Downloading: 100%
  • Removing symfony/web-profiler-bundle (v2.3.7)
  • Installing symfony/web-profiler-bundle (v2.4.0)
    Downloading: 100%

And here is the Exception detail in my deveropment environment:

Whoops, looks like something went wrong.
1/1 FatalErrorException: Error: Call to undefined method Symfony\Component\HttpKernel\Event\FilterResponseEvent::isMasterRequest() in C:\Users\xxx\wc\Silex-Kitchen-Edition\vendor\symfony\web-profiler-bundle\Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener.php line 68

in C:\Users\xxx\wc\Silex-Kitchen-Edition\vendor\symfony\web-profiler-bundle\Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener.php line 68
at ErrorHandler->handleFatalError(object(ExceptionHandler), array('type' => '1', 'message' => 'Call to undefined method Symfony\Component\HttpKernel\Event\FilterResponseEvent::isMasterRequest()', 'file' => 'C:\Users\xxx\wc\Silex-Kitchen-Edition\vendor\symfony\web-profiler-bundle\Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener.php', 'line' => '68')) in C:\Users\xxx\wc\Silex-Kitchen-Edition\vendor\symfony\debug\Symfony\Component\Debug\ErrorHandler.php line 212

Let me know if this should be reported directly in the Silex proyect.

Thanks!

Missing Doctrine

Hi,

By following the install guidelines provided, my installation ends up missing Doctrine :- (

git clone https://github.com/lyrixx/Silex-Kitchen-Edition.git PATH/TO/YOUR/APP
cd PATH/TO/YOUR/APP
curl -s http://getcomposer.org/installer | php
php composer.phar install

Manually adding "doctrine/dbal": ">=2.2.0,<2.4.0-dev" to the composer file and updating, downloads the library. Afterwards continuing and follow Silex Doctrine guide, I add a database connection in app.php.

$app->register(new Silex\Provider\DoctrineServiceProvider(), array(
'db.options' => array(
'driver' => 'pdo_mysql',
'host' => 'localhost',
'dbname' => 'test',
'user' => 'test',
'password' => ''
)
));

However this attempt brings:

Fatal error: Class 'Doctrine\DBAL\Configuration' not found in /home/www/*/vendor/silex/silex/src/Silex/Provider/DoctrineServiceProvider.php on line 86

Currently I'm unable to connect to any database using Silex Kitchen Edition.

If this is considered no real issue, or is because of errors on my end I apologize :)

Thanks

Install fails due to silex-assetic git url

The installation failed for me because the url [email protected]:mheap/Silex-Assetic.git in composer.lock is protected. After I deleted the lock file and retried, the install script ran to completion (although I am not sure how it all will work since I deleted the original lock file). The lock file should either be removed or fixed.

Add docs/examples to manage locale in URL

Could you please make examples with locale in url like '/{locale}/{message}/{name}'?

I cannot make it work.

For your information, here is what I did:

// Added to controllers.php
$app->before(function () use ($app) {
    if ($locale = $app['request']->get('locale')) {
        $app['locale'] = $locale;
    }
});

$app->get('/{locale}/{message}/{name}', function ($message, $name) use ($app) {
    return $app['translator']->trans($message, array('%name%' => $name));
});
// added to en.yml
hello: Hello %name%
//added to fr.yml
hello: Salut %name%
//updated app.php
$app->register(new TranslationServiceProvider(), array(
    'translator.domains' => array(
        'messages' => array(
            'fr' => __DIR__.'/../resources/locales/fr.yml',
            'en' => __DIR__.'/../resources/locales/en.yml',
        ),
    )
));

When I run: http://silex-kitchen/fr/hello/toto
The response is: Hello toto

Composer fails if assetic is disabled

If Assetic is disabled in either the prod.php or dev.php files, composer then fails:

#resources/config/dev.php

$app['assetic.enabled'] = false;

Running composer then fails with the following:

Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing symfony/css-selector (v2.2.0)
    Loading from cache

  - Installing symfony/dom-crawler (v2.2.0)
    Loading from cache

  - Installing symfony/browser-kit (v2.2.0)
    Loading from cache

symfony/browser-kit suggests installing symfony/process (2.2.*)
Generating autoload files

[InvalidArgumentException]
Identifier "assetic.dumper" is not defined.

assetic:dump

Either I'm doing it wrong (likely), or there is an issue. I have deleted the cache at ~/.composer/cache and also removed 'vendor/*' and ran 'composer install --dev'.

Help

require_once DIR.'/../vendor/silex/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php';

Warning: require_once(/home/icehero/www/Silex-Kitchen-Edition/src/../vendor/silex/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php): failed to open stream: No such file or directory in /home/icehero/www/Silex-Kitchen-Edition/src/autoload.php on line 3 Call Stack: 0.0000 635840 1. {main}() /home/icehero/www/Silex-Kitchen-Edition/web/index.php:0 0.0001 636352 2. require_once('/home/icehero/www/Silex-Kitchen-Edition/src/autoload.php') /home/icehero/www/Silex-Kitchen-Edition/web/index.php:4 Fatal error: require_once(): Failed opening required '/home/icehero/www/Silex-Kitchen-Edition/src/../vendor/silex/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/icehero/www/Silex-Kitchen-Edition/src/autoload.php on line 3 Call Stack: 0.0000 635840 1. {main}() /home/icehero/www/Silex-Kitchen-Edition/web/index.php:0 0.0001 636352 2. require_once('/home/icehero/www/Silex-Kitchen-Edition/src/autoload.php') /home/icehero/www/Silex-Kitchen-Edition/web/index.php:4

"fatal: reference is not a tree" during a submodule update

Hi all!
I trying to execute git submodule update --init --recursive command, after git clone but get an error

$ git submodule update --init --recursive
fatal: reference is not a tree: cbca894953e5ed1d32a7f77a9fbf364deff40960
Unable to checkout 'cbca894953e5ed1d32a7f77a9fbf364deff40960' in submodule path 'vendor/Symfony/Component/HttpFoundation'
Failed to recurse into submodule path 'vendor/silex'

Twig_Error_Syntax: Unknown "render" function in "@WebProfiler/Profiler/layout.html.twig"

Fresh install of Kitchen-Edition. It throws the following error:

Twig_Error_Syntax in ExpressionParser.php line 573: Unknown "render" function in "@WebProfiler/Profiler/layout.html.twig" at line 67.

I did a bit of research and found the following suggestion for the problem: GitHub Comment regarding silexphp/Silex-WebProfiler

After adding the following line to both index.php and index_dev.php, before $app->run(), we're working again:

$app->register(new Silex\Provider\HttpFragmentServiceProvider());

Session not created

I suspect this is a new development in the Silex core, but the session data stored by the example code is not persisting. The issue is fixed by calling:

$app['session']->start();

before storing data in the session. This could be inserted at line #44 of controllers.php, but it doesn't feel like the right place. An alternative solution I came up with is changing line #24 of app.php to:

$app->register(new SessionServiceProvider(), array(
    'session.storage.options'   => array(
        'auto_start'            => 1
    )
));

The downside of this approach is the session is always running. There is currently a similar open issue on Silex: fabpot/Silex#274

Failed to install dependencies

$ composer install
Loading composer repositories with package information
Installing dependencies from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for symfony/event-dispatcher == 9999999-dev -> satisfiable by symfony/symfony dev-master, symfony/event-dispatcher dev-master.
    - Conclusion: don't install symfony/event-dispatcher 2.1.x-dev
    - Can only install one of: symfony/symfony dev-master, symfony/symfony 2.1.x-dev.
    - don't install symfony/yaml dev-master|don't install symfony/symfony 2.1.x-dev
    - Installation request for symfony/event-dispatcher == 2.1.9999999.9999999-dev -> satisfiable by symfony/symfony 2.1.x-dev, symfony/event-dispatcher 2.1.x-dev.
    - Installation request for symfony/yaml == 9999999-dev -> satisfiable by symfony/symfony dev-master, symfony/yaml dev-master.

Update Kitchen Edition

Hi @lyrixx

Thanks for providing this Silex kitchen Edition project, it's been very helpfull to get started with Silex!
Would it be possible to give this project an update?

This runs on 1.1, while there is now Silex 1.3. Bootstrap is still the older version.. I noticed the other issue about it from a year ago.. yet nothing has changed.
Also including Swift Mailer would be very usefull, since basically every website needs an email form somewhere.

I found this to be by far the best starter project for Silex, so would love to see it being maintained.

Thanks!

Upgrade to Bootstrap 3.1.x

If I create a PR with for this can it be merged, or is there some other reason that this hasn't been done already?

The requested URL was not found on this server

Hi, I have installed the Kitchen Edition. When I tried it the homepage goes well, but when I went to logout/login/cache-page it give me the error: Not Found The requested URL /web/logout was not found on this server.

I do not changed anything in controllers.php. How can I fix it??
Thanks very much

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.