このcomposer.json
構成は私のアプリで機能するようです。
"repositories": [
{
"type": "git",
"url": "https://github.com/formers/former.git"
}
],
"require": {
"laravel/lumen-framework": "5.0.*",
"vlucas/phpdotenv": "~1.0",
"anahkiasen/former": "4.0.x-dev"
},
実行後:
composer update -vvv
私は自分を更新しますbootstrap/app.php
:
/*
|--------------------------------------------------------------------------
| Register Service Providers
|--------------------------------------------------------------------------
|
| Here we will register all of the application's service providers which
| are used to bind services into the container. Service providers are
| totally optional, so you are not required to uncomment this line.
|
*/
// $app->register('App\Providers\AppServiceProvider');
$app->register('Former\FormerServiceProvider');
でのテストapp/Http/routes.php
:
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
use Former\Facades\Former;
$app->get('/', function() use ($app) {
echo Former::open()->method('GET');
echo Former::text('name')->required();
echo Former::close();
});
出力:
<form accept-charset="utf-8" class="form-horizontal" method="GET">
<div class="form-group required">
<label for="name" class="control-label col-lg-2 col-sm-4">Name<sup>*</sup></label>
<div class="col-lg-10 col-sm-8">
<input class="form-control" required="true" id="name" type="text" name="name">
</div>
</div>
</form>
すべてうまくいくようです。問題は古いパッケージだと思います。
アップデート
私はapp/Http/routes.php
次のように変更します:
$app->get('/', function() use ($app) {
return view('foo');
});
そして、これは私のものfoo.blade.php
です:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Foo</title>
</head>
<body>
{!! Former\Facades\Former::open()->method('GET'); !!}
{!! Former\Facades\Former::text('name')->required(); !!}
{!! Former\Facades\Former::close(); !!}
</body>
</html>
そして、それは機能します。