The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

Slim 3.0 and Composer

danielbannert's Avatar

danielbannert

25 Dec, 2013 06:47 PM

Hi, fast and simple question how can i autoload Slim and Pimple without composer?
Because many web server don't use composer...

  1. Support Staff 1 Posted by Josh Lockhart on 25 Dec, 2013 07:00 PM

    Josh Lockhart's Avatar

    Both Slim and Twig provide their own autoloaders. Refer to Twig's documentation for registering its autoloader. For slim, require Slim/Slim.php and then invoke \Slim::registerAutoloader().

  2. Josh Lockhart closed this discussion on 25 Dec, 2013 07:00 PM.

  3. danielbannert re-opened this discussion on 25 Dec, 2013 09:10 PM

  4. 2 Posted by danielbannert on 25 Dec, 2013 09:10 PM

    danielbannert's Avatar

    I use Slim 3.0 or Slim DEV and if i try

    include('pimple/pimple.php');
    include('Slim/Autoloader');
    Slim\Autoloader::register()
    $app = new pimple(); $app['app'] = new App();

    $app['app']->run;

    i get a error like that:

    Uncaught exception 'ErrorException' with message 'Invalid argument supplied for foreach()' in Slim/Http/Cookies.php:153 Stack trace: #0 Slim/Http/Cookies.php(153): Slim\App::handleErrors(2, 'Invalid argumen...', '/www/htdocs/w00...', 153, Array) #1 Slim/App/App.php(1233): Slim\Http\Cookies->setHeaders(Object(Slim\Http\Headers)) #2 Slim/App.php(1098): Slim\App->finalize() #3 /www/htdocs/w00f2e51/cresk.de/cresk_dev/cresk_v4/index.php(103): Slim\App->run() #4 {main} thrown in Slim/Http/Cookies.php on line 153

  5. 3 Posted by danielbannert on 30 Dec, 2013 01:36 AM

    danielbannert's Avatar

    Any ideas?

  6. Support Staff 4 Posted by Andrew Smith on 31 Dec, 2013 11:51 AM

    Andrew Smith's Avatar

    Slim 3.0 is already in a pimple container so you wouldn't need to add it again. Also just to note you don't need composer on your server in order to use composer. You can do all your composer setup locally then upload to your server. Remember composer is only a dependency manager that has a autoloader. So its not something that have to be installed on the server like a PHP module.

  7. 5 Posted by danielbannert on 31 Dec, 2013 12:45 PM

    danielbannert's Avatar

    okey, but my next question is, why i cant use slim autoloader to load slim and if i try it im getting a error like above?

  8. Support Staff 6 Posted by Andrew Smith on 31 Dec, 2013 12:58 PM

    Andrew Smith's Avatar

    I am not sure, I will test this out in a minute and get back to you.

  9. Support Staff 7 Posted by Andrew Smith on 31 Dec, 2013 01:29 PM

    Andrew Smith's Avatar

    Yeah the Slim Autoloader is broken, this is probably due to the new interfaces that were added and since most of us on the team are using composer to test our Slim setup we didn't notice this, plus Slim 3.0 is currently not stable as its in constant development. This will be resolved by the time we hit final release.

  10. Support Staff 8 Posted by Josh Lockhart on 31 Dec, 2013 02:14 PM

    Josh Lockhart's Avatar

    Like Andrew said, the dev branch is under heavy development right now. Open a ticket on the issue tracker and we'll look into this.

  11. 9 Posted by Gaurav on 18 Sep, 2016 05:03 PM

    Gaurav's Avatar

    thanks, in association with https://facetimeforwindows-pc.com/

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac