将Sentinel与脚本

时间:2015-10-31 19:14:26

标签: php sentinel

我试图将Cartalyst Sentinel用于我的脚本。我从github下载了这些文件。 (https://github.com/cartalyst/sentinel)。我已将它放在我的wamp上,我正在尝试按照此处的说明进行操作(https://cartalyst.com/manual/sentinel/2.0#native)。

这是我到目前为止所做的:

<?php

// Import the Sentinel Classes

use sentinel\src\Native\Facades\Sentinel;
use Illuminate\Database\Capsule\Manager as Capsule;

require 'vendor/autoload.php';

$capsule = new Capsule;

$capsule->addConnection([
    'driver' => 'mysql',
    'host' => 'localhost',
    'database' => 'sentinel',
    'username' => '',
    'password' => 'secret',
    'charset' => 'utf8',
    'collation' => 'utf8_unicode_ci',
]);


$capsule->bootEloquent();

?> code here

我已按照说明操作,但我从第一次使用时更改了目录...我似乎无法找到vendor / autoload.php。我得到了无法找到流错误。

当我删除它时,我收到此错误。

( ! ) Fatal error: Class 'Illuminate\Database\Capsule\Manager' not found in C:\wamp\www\lab\login.php on line 10

所以我有点困惑,因为手册并没有真正提供解决问题和我们需要的方法。

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:0)

似乎您以后没有更新Illuminate Database组件的实现。

要使用它,请运行:

composer require illuminate/database illuminate/events symfony/http-foundation 

这将安装Illuminate\Database\Capsule,希望它能起作用。

我要回答这个问题晚了4年,但我相信这可能会帮助陷入困境的人。