Maki
Maki

Reputation: 319

Slim.php is missing from Slim-3.x

I am following a tutorial from here:

https://www.simplifiedcoding.net/php-restful-api-framework-slim-tutorial-1/

The tutor said download slim at:

https://github.com/slimphp/Slim

Everything seems ok now but when I try to load the REST at Mozilla's REST easy app. I was given the error:

Warning: require(.././libs/Slim/Slim.php): failed to open stream: No such file or directory in C:\xampp\htdocs\StudentApp\v1\index.php on line 5

Fatal error: require(): Failed opening required '.././libs/Slim/Slim.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\StudentApp\v1\index.php on line 5

I checked the Slim directory and Slim.php is really missing. Can anyone pls help me. Thanks.

Upvotes: 1

Views: 1570

Answers (2)

Mehmet Sefa Balık
Mehmet Sefa Balık

Reputation: 499

Instead of Slim.php and \Slim\Slim(), just use App.php and \Slim\App() as mentioned in the documentation of Slim.

To Explain Well

Use:

require 'vendor/autoload.php';

Instead of:

require '.././libs/Slim/Slim.php';

And use:

$app = new \Slim\App();

Instead of:

$app = new \Slim\Slim();

Upvotes: 3

Maki
Maki

Reputation: 319

I have found a solution. What I did is that I downloaded the Slim-2x version from here:

https://github.com/codeguy/Slim

I copied the Slim.php of the Slim-2x to the Slim-3x. It worked but I think there are better solution for this.

Upvotes: 0

Related Questions