Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we expect a Silex bootstrap? #38

Closed
bouiboui opened this issue May 13, 2016 · 9 comments
Closed

Can we expect a Silex bootstrap? #38

bouiboui opened this issue May 13, 2016 · 9 comments

Comments

@bouiboui
Copy link

I tried ppm on a project of mine thinking it would be compatible since Silex and Symfony share a lot... It does not. Do you plan on supporting Silex anytime in the future?

@improved-broccoli
Copy link

improved-broccoli commented Jul 4, 2016

I'm currently working on a bootstrap for Silex, here is the first draft:

<?php

namespace PHPPM\Bootstraps;

use PHPPM\Bootstraps\BootstrapInterface;
use Silex\Application;

class Silex implements BootstrapInterface
{
    /**
     * @var string
     */
    private $appEnv;

    /**
     * @var bool
     */
    private $debug;

    /**
     * @param $appenv
     * @param $debug
     */
    public function __construct($appenv, $debug)
    {
        $this->appEnv = $appenv;
        $this->debug = $debug;
    }

    /**
     * @return Application
     */
    public function getApplication()
    {
        $app = require './src/app.php';
        require './config/prod.php';
        require './src/controllers.php';

        return $app;
    }

    /**
     * @return string
     */
    public function getStaticDirectory()
    {
        return './web';
    }
}

Works with a new Silex Skeleton:

composer create-project fabpot/silex-skeleton /var/www/helloworld && \
cd /var/www/helloworld && \
composer config minimum-stability dev && \
composer require php-pm/httpkernel-adapter:dev-master && \
composer require php-pm/php-pm:dev-master

Then copy the bootstrap file to /var/www/helloworld/vendor/php-pm/httpkernel-adapter/Bootstraps/Silex.php

Dump your autoloader to make sure the class you copy is taken in account:
composer dumpautoload

Finally launch the app with: ./vendor/bin/ppm start --bootstrap=silex

If I produce a better version, I will do a PR.

P.S : benchmark results on a MacBook Pro Early 2015 CPU: i5@2.7GHZ RAM: 8GB
Fresh Silex skeleton is dockerized.

$ siege -b -i -c 10 -t1M

Transactions:                  12446 hits
Availability:                 100.00 %
Elapsed time:                  59.35 secs
Data transferred:               9.77 MB
Response time:                  0.05 secs
Transaction rate:             209.71 trans/sec
Throughput:                     0.16 MB/sec
Concurrency:                    9.97
Successful transactions:       12446
Failed transactions:               0
Longest transaction:            0.42
Shortest transaction:           0.00

@bouiboui
Copy link
Author

bouiboui commented Jul 4, 2016

That's awesome, hopefully I can try it soon

@dave08
Copy link

dave08 commented Aug 6, 2017

@jbenoit2011 Is what you proposed stable for production? Are you still working on this? Also would this be compatible with Silex 1.~? Thanks!!

@improved-broccoli
Copy link

improved-broccoli commented Aug 7, 2017

The code I pasted above has ran in production on an app handling thousands of requests per day built with Silex 2.x while several months with no issues. But I did not test it with Silex 1.x.

@andig
Copy link
Contributor

andig commented Aug 7, 2017

@jbenoit2011 would you care to submit a PR?

@andig
Copy link
Contributor

andig commented Jan 29, 2018

Closing due to missing feedback. Silex is meanwhile deprecated as well.

@andig andig closed this as completed Jan 29, 2018
@charly22
Copy link

charly22 commented Jan 31, 2018

@andig what do you mean with Silex being deprecated?

Besides that, what kind of feedback do you need to keep this issue open?

@alsar
Copy link

alsar commented Jan 31, 2018

Silex is not developed anymore. It was deprecated a few weeks ago.
http://symfony.com/blog/the-end-of-silex

@charly22
Copy link

@alsar thanks for the notice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants