Giter Site home page Giter Site logo

slim-skeleton's People

Contributors

a-r-m-i-n avatar agung-ap avatar akrabat avatar antnee avatar antoninom90 avatar atefbb avatar big-shark avatar casmith avatar dependabot-preview[bot] avatar dependabot[bot] avatar dmitrev avatar dopesong avatar flangofas avatar geggleto avatar jamesrweb avatar jayywalker avatar jeremykendall avatar joubertredrat avatar l0gicgate avatar localheinz avatar maccath avatar manavo avatar maurobonfietti avatar mbohal avatar nbayramberdiyev avatar samsonasik avatar silentworks avatar ssnepenthe avatar vakrug avatar yakubenko 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  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

slim-skeleton's Issues

manully add to existing project

Hi I am wondering how I can add this to a composer.json that I have already ran and don't want to have to start all over again.

This is what my composer .json looks like

{
    "require": {
       "google/cloud":"0.2.*",
	      "mongodb/mongodb":"1.0.*"
    }
}

add 3.x release ?

Hi,

maybe i m missing something, I was expecting to install slim3, i got slim 2 after i run the composer generator.

Issue with creating the container.

I am trying to create a service for the database connection. I have used the same steps as given in the slim 3 and pimple DI documentation. But Container is not getting created.

$container['dbMeedo'] = function($c) {
    $arrDriverDetails = $settings = $c->get('settings')['dbMeedo'];
    $MedooDb = new Medoo($arrDriverDetails);
    return $MedooDb;
};

slim/extras version dev-release-1.0.3 not available

It looks like slim/extras version dev-release-1.0.3 isn't available on packagist anymore, it be great to update to whatever stable version makes sense.

Actual error:

composer.phar create-project slim/slim-skeleton tmp
Installing slim/slim-skeleton (dev-master 1.0.1)
  - Installing slim/slim-skeleton (dev-master master)
    Cloning master

Created project in tmp
Installing dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package slim/extras dev-release-1.0.3 could not be found.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion for more details.

Locale

Hello ,
I want to localize my slim app , anyone help me to do this ? is there any way to localize app made from slim-skeleton ?

Update Description

Update description Slim Framework 2 skeleton application => Slim Framework 3 skeleton application

Are pull requests being looked at?

Hey,

I have been using the slim for some recent projects and I would like to contribute but I see pull requests from last year that haven't been rejected or accepted.

Is anyone doing any review on the pull requests?

Composer complaines about version

I ran composer create project slim/slim-skeleton [my-project]
and I got...
[UnexpectedValueException]
Could not parse version constraint slim: Invalid version string [my-project]

As a 'good citizen' I follow the instructions by the letter but...
My guess is, create project requires a version as second parameter ... hum no tried that... too many arguments!!!
OK I run out of ideas.... Any help?

Can not access static files with query string (the `?`)

The static file's URL is like http://localhost:8080/vendor/font-awesome/fonts/fontawesome-webfont.woff2?v=4.4.0
And It report a 404.

It is because the is_file() called in line 5 of index.php regard file with ?v=4.4.0 as a different file path, so this function yields false.

I found 2 ways to fix it.

  1. change the line 5 of index.php to $file = __DIR__ . explode('?', $_SERVER['REQUEST_URI'])[0];
  2. start server without router script like php -S 0.0.0.0:8080 -t public

No input file specified.

I have setup as described in this tutorial, but still i am getting No input file specified when i try hit this url
http://aami.noqplz.com/App/public/Hello
the above url shows

**Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator and inform them of the time the error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.**

but this
http://aami.noqplz.com/App/public/ Url working fine.

and this url
http://aami.noqplz.com/App/public/index.php/Hello/Devendra
Shows No input file specified.
Please help me. i am in problem.

what does the container callback param `$c` mean in dependencies.php?

Hi,I am new fish about slim, I cloned the Slim-Skeleton to my computer,and it works fine.But when I check the code,I am confused about the

 $container['renderer'] = function ($c) {
    $settings = $c->get('settings')['renderer'];
    return new Slim\Views\PhpRenderer($settings['template_path']);
};

in the dependencies.php ? what does the param $c mean?

slim skeleton app file structure differs from repository when installed with composer

hello, i developed a rest api about a month ago, now im trying to set a production enviroment but when i install the skeleton, i get a different file structure from any previous install, the src folder is gone and theres just the public folder available with all the skeleton code inside the index.php file, is there a way i can install the older one, wich includes src folder, i dont want to mess the file order i previously had with older file structure.

thanks.

How to change db setting inside middleware ?

i've defined db setting like this

//settings.php
        'db' => [
            'driver' => 'mysql',
            'host' => getenv('DB_HOST'),
            'port' => '3306',
            'database' => getenv('DB_DATABASE'),
            'username' => getenv('DB_USERNAME'),
            'password' => getenv('DB_PASSWORD'),
            'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix' => '',
        ],
//dependencies.php
$settings = $container->get('settings')['db'];
$capsule = new \Illuminate\Database\Capsule\Manager;
$capsule->addConnection($settings);
$capsule->setAsGlobal();
$capsule->bootEloquent();

$container['db'] = function ($c) use($capsule) {
	return $capsule;
};
//middleware.php
$change_database = function($request, $response, $next) use($container) {
	$input = $request->getParsedBody();
	$channel = $input['channel'];
	$response = $next($request, $response);
	return $response;
};

how can i change it inside middleware ?

Remove use of Slim-Extras

It's no longer maintained and has been split up. I've been bitten by two dependency bugs in it already - one is that it needs 2.3.x and the other is one I've made a pr to this repo for - so it would be nice to have it updated.

If I get time, I'll make a pr, but wanted to make this issue so that it's at least known.

Question on app initialization

Hello.

I remember in Slim 2 we used to write settings and routes inside index.php and now they have moved into separate files like settings.php, routes.php. Is the current approach adopted from some other framework?

I see some disadvantages with it:

  • there is no bootstrap file, so when we want to write a CLI command and access the container, we have to copy-paste initialization code from index.php
  • when everything was in a single file it was faster to read. As Slim is (was?) a microframework there would not be many routes and the file size was not large so it was ok to keep everything inside the file.

I can suggest an alternative approach: we could make a bootstrap file (initializing autoloading, App class, DI container) and index.php with middleware and routes. So the CLI command could just require a bootstrap file and get fully configured App object.

What do you think about it?

make BaseTestCase a little more modular

I ran into some problems writing a Slim app with this as the framework, I wanted to explain what problems I ran into trying to test my app, and how I worked around them:

  • I needed a way to call $this->runApp and have the test provide HTTP Basic Auth credentials. I added a fourth parameter to the function call:

    public function runApp($requestMethod, $requestUri, $requestData = null, $auth = array()) {

    then $auth['user'] and $auth['pass'] to get the credentials for the request. We could also try to create a Request object and pass that in instead, like this: https://github.com/twilio/twilio-php/blob/master/Twilio/Tests/Request.php

  • I needed a way to change a dependency after I created the app. For example, swap in a 3rd party client that has some different behavior than the default client, for this particular test. I added this:

        public function getApp(array $settings = null) {
            // necessary for flash messages
            $_SESSION = array();
    
            // Use the application settings
            if (is_null($settings)) {
                $settings = $this->settings();
            }
    
            // Instantiate the application
            $app = new App(array('settings' => $settings));
    
            // Set up dependencies
            require __DIR__ . '/../../src/dependencies.php';
    
            require __DIR__ . '/../../src/middleware.php';
    
            // Register routes
            require __DIR__ . '/../../src/routes.php';
    
            return $app;
        }

    and then this:

    // Run a request on a given app.
    public function do($app, $requestMethod, $requestUri, $requestData = null, $auth = array()) {
        // Create a mock environment for testing with
        $arr = array(
            'REQUEST_METHOD' => $requestMethod,
            'REQUEST_URI' => $requestUri,
        );
        $environment = Environment::mock($arr);
    
        // Set up a request object based on the environment
        $request = Request::createFromEnvironment($environment);
    
        // Add request data, if it exists
        if (isset($requestData)) {
            $request = $request->withParsedBody($requestData);
        }
    
        // Set up a response object
        $response = new Response();
        if (isset($auth['user'])) {
            $request = $request->withHeader('Authorization', 'Basic ' . base64_encode("${auth['user']}:${auth['pass']}"));
        }
    
        // Process the application
        try {
            return $app->process($request, $response);
        } finally {
            $_SESSION = array();
        }
    }

    and $this->runApp just combines those two. That way I can get the app and modify dependencies and then call do and run it with the modified dependency.

    It's a little annoying that the container doesn't provide explicit interfaces for changing things.

  • I needed a way to modify the settings on a per-test basis. I accomplished this by having getApp take an optional settings object, and adding $this->settings() to get the application's settings.

    // Get the application's settings.
    protected function settings() {
        $settings = require __DIR__ . '/../../src/settings.php';
        $settings['settings']['publicHost'] = 'example.com';
        $settings['settings']['webhook_username'] = 'user';
        $settings['settings']['webhook_password'] = 'pass';
        return $settings['settings'];
    }
    
    /**
     * Process the application given a request method and URI
     *
     * @param string $requestMethod the request method (e.g. GET, POST, etc.)
     * @param string $requestUri the request URI
     * @param array|object|null $requestData the request data
     * @return \Slim\Http\Response
     */
    public function runApp($requestMethod, $requestUri, $requestData = null, $auth = array()) {
    
        $app = $this->getApp();
        return $this->do($app, $requestMethod, $requestUri, $requestData, $auth);
    }

Happy to submit those changes as a changeset if you want.

How to integrate right way in to Slim?

Hi,

I have used Slim3 now for a week and a half. My application is very simple and it has cli access through slim-cli. What I currently have noticed is that my own custom php classes are not using Slim almost at all, for example I would like to use logger/settings defined in Slim (in dependencies.php) in my own classes, but how do I do that?

Referencing this: slimphp/Slim#1722

Since you removed Slim::getInstance(), your current slim-skeleton app does not show up any example how you get handle to your slim app in your own custom classes.

Could you provide simple examples from that in your skeleton app?

Br,
-Markku

Docker Compose Bug?

in docker-compose.yml the line:

command: php -S 0.0.0.0:8080 -t public index.php

Was throwing errors for me:

bash-3.2$ docker-compose up
Recreating myfirstslimphpapp_slim_1 ...
Recreating myfirstslimphpapp_slim_1 ... done
Attaching to myfirstslimphpapp_slim_1
slim_1  | PHP 7.2.2 Development Server started at Thu Feb  8 17:13:57 2018

screen shot 2018-02-08 at 12 14 27

I had to change it to:

command: php -S 0.0.0.0:8080 -t public
bash-3.2$ docker-compose up
Recreating myfirstslimphpapp_slim_1 ...
Recreating myfirstslimphpapp_slim_1 ... done
Attaching to myfirstslimphpapp_slim_1
slim_1  | PHP 7.2.2 Development Server started at Thu Feb  8 17:14:53 2018

screen shot 2018-02-08 at 12 15 32

Am I doing something wrong or is this a bug that should be fixed in the project?

BaseTestCase should store app as local property

I think the initialisation of $app should be stored into a protected variable so setup / teardown methods can operate on it or access the container where necessary. e.g. I'm currently using the setup and teardown methods to begin a transaction and rollback at the end of the test respectively to prevent the tests from affecting my test database. I'm setting up the app in the setup method.

I've also added a little helper method for the functional test basetestcase called getResponseBody to simple get the body content of the response as a string such return $response->getBody()->__toString(). Is there a simpler way to get access to the response body as a string? If not, this would make a nice addition to the BaseTestCase.

Can't generate code coverage report with phpunit

Out of the box, the unit tests in this skeleton are a good starting point as such, but it's not possible to generate a code coverage report:

phpunit --coverage-text
PHPUnit 5.7.26 by Sebastian Bergmann and contributors.

Undefined variable: app

Perhaps the way the tests are bootstrapped needs to be altered for this?

Either way, the coverage report is a great help for people who want to build comprehensive tests, so it would be handy if that could work out of the box too.

New slim-skeleton not working on nginx getting 403 message

Hi I just created a new project with composer composer create-project slim/slim-skeleton
and in my nginx.conf I have this settings.
location ~ ^/slim-skeleton{
try_files $uri $uri/ /slim-skeleton/public/index.php$is_args$args;
}
but my output I get as this

<title>403 Forbidden</title>

403 Forbidden


nginx

Timezone error

First time clean install of this repo:

Fatal error: Uncaught exception 'ErrorException' with message 'date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.' in /Users/Superpencil/Desktop/Sour/vendor/monolog/monolog/src/Monolog/Logger.php:214 Stack trace: #0 [internal function]: Slim\Slim::handleErrors(2, 'date_default_ti...', '/Users/Superpen...', 214, Array) #1 /Users/Superpencil/Desktop/Sour/vendor/monolog/monolog/src/Monolog/Logger.php(214): date_default_timezone_get() #2 /Users/Superpencil/Desktop/Sour/vendor/monolog/monolog/src/Monolog/Logger.php(507): Monolog\Logger->addRecord(400, Object(ErrorException), Array) #3 /Users/Superpencil/Desktop/Sour/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php(72): Mo in /Users/Superpencil/Desktop/Sour/vendor/monolog/monolog/src/Monolog/Logger.php on line 214

Adding this to the index.php fixes it

// Set default timezone
date_default_timezone_set('America/New_York');

Consider taking advantage of PHP-DI container compilation

According to the PHP-DI docs, setting definitions in the container directly via the set method prevents entries from being added to a compiled container.

Would you have any objections to reworking the container creation logic in order to:

  1. Use the DI\ContainerBuilder class
  2. Conditionally enable compilation based on some environment setting
  3. Use array definitions instead of directly setting items on the container

Duplicate app creation code

The code used to create the app instance is duplicated in public/index.php and tests/TestCase.php.

What would you think about moving this logic to a dedicated file (e.g. app/bootstrap.php) which would return the app instance?

Wherever the app is needed you can now just do:

$app = require __DIR__ . '/../app/bootstrap.php';

transfer session between routes

Hi,

i had create a simple script to transfer session between routes but seems not working.
every time i do var_dump it given empty array.
i try native $_SESSION and slim-session but still no luck.

can anyone help me why my session not working?

here's my code :

session_start();

// routes
$app->get('/', function ($request, $response, $args) {
$arr_data_content = array();
print_r($_SESSION);
// some code
return $this->renderer->render($response, 'index.phtml', $arr_data_content);
});

$app->get('/login', function ($request, $response, $args) {
$base_url = $request->getUri()->getBaseUrl();
$urlredirect = $base_url;
if (isset($_SESSION['loggedin']['user'])) {
return $response->withRedirect((string)$urlredirect, 301);
}
$arr_data_content = array();
$arr_data_content['header_set'] = 'Login';
return $this->renderer->render($response, 'signin.phtml', $arr_data_content);
});

$app->post('/check-login', function ($request, $response, $args) {
$base_url = $request->getUri()->getBaseUrl();
$allPostPutVars = $request->getParsedBody();
$user = $allPostPutVars['username'];
$pass = $allPostPutVars['password'];
if (isset($user) && isset($pass)) {
$_SESSION['loggedin']['user'] = $user;
$_SESSION['loggedin']['pass'] = $pass;
return $response->withRedirect($base_url, 301);
}
return $response->withRedirect($base_url . '/login', 301);
});

Thanks,

Add `tests` directory and example for test

Should we add tests directory and an example for test

class \ExampleTest extends \PHPUnit_Framework_TestCase
{
    public function testBasicExample()
    {
        $this->markTestSkipped('This is an example basic test');
    }
}

Why PHP-View?

PHP-View has no built-in mitigation from XSS attacks
source

Why PHP-View instead Twig?

PHP Fatal error: Uncaught Error: Class 'Monolog\Logger' not found

> php -S localhost:8080 -t public
[Sat Jun 22 06:23:31 2019] PHP Fatal error:  Uncaught Error: Class 'Monolog\Logger' not found in /mnt/g/AkademikApps/src/settings.php:16
Stack trace:
#0 /mnt/g/AkademikApps/public/index.php(17): require()
#1 {main}
  thrown in /mnt/g/AkademikApps/src/settings.php on line 16
[Sat Jun 22 06:23:31 2019] 127.0.0.1:63621 [500]: / - Uncaught Error: Class 'Monolog\Logger' not found in /mnt/g/AkademikApps/src/settings.php:16
Stack trace:
#0 /mnt/g/AkademikApps/public/index.php(17): require()
#1 {main}
  thrown in /mnt/g/AkademikApps/src/settings.php on line 16

Fatal error on composer start

Internal PHP server composer start throws fatal error on the request:

> php -S localhost:8080 -t public public/index.php
[Sun Jan 28 19:32:59 2018] PHP Warning:  Unknown: failed to open stream: No such file or directory in Unknown on line 0
[Sun Jan 28 19:32:59 2018] PHP Fatal error:  Unknown: Failed opening required '/home/skoro/Projects/php/test/public/public/index.php' (include_path='.:/usr/share/php') in Unknown on line 0

Problem whit index.php in public folder .htaccess

My problem is to run my project on an apache server, if I try to reach with this url http://localhost/slim-app/some_route I receive this error:

error1

But if I try to navigate to http://localhost/slim-app/public/some_route it works.

My folder structure looks like this:

/slim-app
 .htaccess
 /logs
 /public
  /css
  /js
  index.php
  .htaccess
 /src
  /helpers
  routes.php
  settings.php
 /templates
  file.twig
 /vendor

This is the .htaccess file in the root project folder "slim-app":

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /slim-app/

    RewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC]
    RewriteRule ^ %1 [L,NE,R=302]

    RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
</IfModule>

This is the .htaccess file in the public directory:

<IfModule mod_rewrite.c>
  RewriteEngine On

  # Some hosts may require you to use the `RewriteBase` directive.
  # Determine the RewriteBase automatically and set it as environment variable.
  # If you are using Apache aliases to do mass virtual hosting or installed the
  # project in a subdirectory, the base path will be prepended to allow proper
  # resolution of the index.php file and to redirect to the correct URI. It will
  # work in environments without path prefix as well, providing a safe, one-size
  # fits all solution. But as you do not need it in this case, you can comment
  # the following 2 lines to eliminate the overhead.
  RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
  RewriteRule ^(.*) - [E=BASE:%1]

  # If the above doesn't work you might need to set the `RewriteBase` directive manually, it should be the
  # absolute physical path to the directory that contains this htaccess file.
  # RewriteBase /

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ index.php [QSA,L]
</IfModule>

I have posted the same question here: https://stackoverflow.com/questions/53152462/slim-framework-index-php-in-public-folder-htaccess

Get queries with params

Inn baseTestCase is request data handling:

if (isset($requestData)) {
            $request = $request->withParsedBody($requestData);
        }

But shouldn't You use $request->withQueryParams($requestData) in GET method?

Docker under win10

Hi,

I just started a skeleton based project. Tried to use the docker (via win10 + docker-tools). I made the call of docker-compose up -d
I do expected a start, but nothing hapened. So I just called a docker-compose up and got the following error message:

starting myslim4test_slim_1 ... done
Attaching to myslim4test_slim1
slim_1 | Directory public does not exists.
myslim4test_slim_1 exited with code 1

And my structure is like the basic, so I do have a public folder. I did not changed anything. Any idea what could be wrong?
Then I copied all the files into a virtualbox (ubuntu, latest, php 7.3). And just hitted the compose start command, and it working well.
Then I tried with docker, same result.

All permission is properly set (755 for dirs, 644 for files). Full permission under windows (since no other option there...).

Cheers

On running tests on fresh install, get phpunit error code 126

Fresh install, application working, went to run the test, got this from the console

sh: 1: phpunit: Permission denied
Script phpunit handling the test event returned with error code 126

Which I believe is "command not executable". I am on Ubuntu 14.04. All permissions in the application directory is 664 files 775 directories, owned by myself and web user www-data.

Did I make a mistake, or is there something about my system or set up that may require an additional step?

Tests not working

I think test are not working because there is no "require DIR . '/../../vendor/autoload.php';" in HomepageTest.php file

Not working with apache (Slim Application Error)

If I open up the index.php running on apache2 with Linux I get the following Slim Application Error:
slim_apache_error_blurred
The directory and file Permissions should be set correctly (user/group + read, write permissions double-checked). The problem is, that I don't know which file causes the problem. Apache log shows no error and the path shown (src/../logs/app.log) does not exist. I thought the logs are written to the logs directory in the project root folder (which is present)?

If I use the PHP-Webserver with the composer start command everything is working fine and I see the Slim 3 Framework Hello Page.

Any suggestions?

Monolog usage appears to break PrettyExceptions

I caused some sort of error in my app (go figure) and the pretty exceptions page through a wobbly:

jose@mactaku:~/Sites/seatgeek/sg-android-artifacts  $ curl -X POST --data-urlencode  "payload@payload" http://localhost/seatgeek/sg-android-artifacts/public/travisci
<br />
<font size='1'><table class='xdebug-error xe-fatal-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Fatal error: Call to a member function error() on a non-object in /Users/jose/Sites/seatgeek/sg-android-artifacts/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php on line <i>71</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0002</td><td bgcolor='#eeeeec' align='right'>239272</td><td bgcolor='#eeeeec'>{main}(  )</td><td title='/Users/jose/Sites/seatgeek/sg-android-artifacts/public/index.php' bgcolor='#eeeeec'>../index.php<b>:</b>0</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.0081</td><td bgcolor='#eeeeec' align='right'>494576</td><td bgcolor='#eeeeec'>Slim\Slim->run(  )</td><td title='/Users/jose/Sites/seatgeek/sg-android-artifacts/public/index.php' bgcolor='#eeeeec'>../index.php<b>:</b>36</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>3</td><td bgcolor='#eeeeec' align='center'>0.0089</td><td bgcolor='#eeeeec' align='right'>523200</td><td bgcolor='#eeeeec'>Slim\Middleware\PrettyExceptions->call(  )</td><td title='/Users/jose/Sites/seatgeek/sg-android-artifacts/vendor/slim/slim/Slim/Slim.php' bgcolor='#eeeeec'>../Slim.php<b>:</b>1254</td></tr>
</table></font>

Relevant middleware code:

public function call()
{
    try {
        $this->next->call();
    } catch (\Exception $e) {
        $log = $this->app->getLog(); // Force Slim to append log to env if not already
        $env = $this->app->environment();
        $env['slim.log']->error($e);
        $this->app->contentType('text/html');
        $this->app->response()->status(500);
        $this->app->response()->body($this->renderBody($env, $e));
    }
}

composer.phar does not exist

In the readme, the setup instructions say to run composer.phar. This file doesn't exist, so instead you'll either need to add composer.phar or update the instructions to use a global composer and add it as a prerequisite.

docker-compose, the container is given php errors

When starting the skeleton with docker-compose, some errors occur.

The error you get in the browser is:

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Unknown: Failed opening required '/var/www/public/public/index.php' (include_path='.:/usr/local/lib/php') in Unknown on line 0

After some time, I saw that there is /public/public/ in the folder name. Then I looked in the docker-compse file. The document root is set to public, but it tries to start public/index.php which is duplicate.

Not working on nginx

Hi,
I have created via the composer a folder. Then I add this settings for nginx

location /apitest {
try_files $uri /public/index.php$is_args$args;
}
but its working either. So how to settle this issue ?

Slight inconvenience with route pattern matching?

I don't know if this is an issue with Slim-Skeleton or the Slim framework in general, but I noticed that in src/routes.php, the order in which you write your routes actually matters in some fringe cases.

For example (and this is what happened for me), let's say I have 2 routes:

$app->get('/hours/{name}', ...);
$app->get('/{date}/{name}', ...);

I noticed that if I write the second route in routes.php before the first route, it essentially makes null any calls to the first route -- and in the second route, $args['date'] will always be the string 'hours'.

Is there a way to reinforce, no matter the order routes are written, that certain paths with concrete names get precedence before those with variable argument-names?

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.