Reputation:
I'm using composer to load classes. It does work for a provider, but it does not load my classes folder. This is my composer.json :
{
"require": {
"silex/silex": "~1.3",
"twig/twig": "^1.33",
"doctrine/dbal": "^2.5",
"uploadcare/uploadcare-php": "^1.5",
"symfony/twig-bridge": "^2.8",
"symfony/form": "^2.8",
"symfony/security-csrf": "^2.8",
"symfony/validator": "^2.8",
"symfony/config": "^2.8",
"symfony/translation": "^2.8"
},
"autoload": {
"psr-4": {
"Models\\": "app/Models/",
"Providers\\": "app/Providers/"
}
}
}
And this is my folder structure:
Webshop
--app
----Config
----Models
---->>Session.php
----Providers
--public
----index.php
--vendor
--views
--composer.jason
--composer.lock
This line is in index.php:
require_once __DIR__.'/../vendor/autoload.php';
But I get this error for some reason:
Fatal error: Class 'Session' not found in E:\Software\XAMPP\htdocs\Webshop\public\index.php on line 32
And in case you might need it, I can give you the session class of course. If anything needs to be added. Please ask and I'll add it within a minute.
Edit
This is my Session top:
<?php
namespace Models;
class Session
{
public static function exists($name)
{
Upvotes: 1
Views: 150
Reputation:
Kyoya solved it! I've forgot to put 'use Models\Session;' in the top of index.html
Upvotes: 1