The Slim Framework support forum has moved to This Tender forum is no longer maintained or monitored.

Add other classes

mesoriginal's Avatar


21 May, 2012 11:13 PM


I have many problems when i try to load some classes in index.php
require 'Slim/Slim.php';
require 'Slim/SomeClass.php'; <-- THIS FILE
$app = new Slim(); ...

?> So... i think the problem maybe is i dont use function autload like this:

require 'Slim/Slim.php';
$app = new Slim(); $app->autoload('SomeClass'); ... ?>

I dont know how i can solve this...

Thanks =)

  1. Support Staff 1 Posted by Andrew Smith on 22 May, 2012 12:42 AM

    Andrew Smith's Avatar

    Hi, there is absolutely nothing wrong with loading classes using require, but you need to instantiate it after. What is the problem you are currently having?

  2. 2 Posted by mesoriginal on 22 May, 2012 01:43 AM

    mesoriginal's Avatar

    I solve It!

    require 'Slim/CoreClass.php';
    $oCore = new Core(); $oCore->hello;

    This is the solution put use($oCore) after function in the index.php


  3. Andrew Smith closed this discussion on 10 Jul, 2012 11:51 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? 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