Help us understand the problem. What is going on with this article?

Voyager(Laravel Admin)のXampp環境へのインストール

More than 1 year has passed since last update.

Voyager構築する方法

XAMPP環境でローカルにVoyagerを構築するまで

環境:Windows 10 + Xampp + PHP7.2 + Laravel5.7 + Composer1.7.3

参考にした記事

のるぼるのるの「Laravel5.7 に管理画面マネージャー「Voyager」を導入する」

Qiita @takky Welcome to Laravel Voyager

Laravelのインストール

※Composerのインストールは済ませておいてください。

cd ***\XAMPP\htdocsでカレントディレクトリを変更して実行

cd ***\XAMPP\htdocs

composer create-project --prefer-dist laravel/laravel <任意のプロジェクト名>

Voyagerのインストール

Php.iniの編集

***/XAMPP/php/php.ini`のphhp.iniファイルを開いて

;extension=***

の「;」を外して必要なextensionを有効にします。

;extension=bz2
extension=curl ;ON
extension=fileinfo ;ON
extension=gd2 ;ON
;extension=gettext
;extension=gmp
;extension=intl
;extension=imap
;extension=interbase
;extension=ldap
extension=mbstring ;ON
extension=exif  ;ON ; Must be after mbstring as it depends on it
extension=mysqli ;ON
;extension=oci8_12c  ; Use with Oracle Database 12c Instant Client
;extension=odbc
;extension=openssl
;extension=pdo_firebird
extension=pdo_mysql ;ON
;extension=pdo_oci
;extension=pdo_odbc
;extension=pdo_pgsql
;extension=pdo_sqlite
;extension=pgsql
;extension=shmop

; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=snmp

;extension=soap
;extension=sockets
;extension=sqlite3
;extension=tidy
;extension=xmlrpc
;extension=xsl

VoyagerをComposerでインストール

cd ***\XAMPP\htdocs\<プロジェクト名>で作成したLaravelプロジェクトフォルダをカレントディレクトリにして実行

cd ***\XAMPP\htdocs\<任意のプロジェクト名>

composer require tcg/voyager

.envの設定

..\XAMPP\htdocs\<任意のプロジェクト名>のフォルダの.envファイルを編集します。

APP_URL=http://localhost:8000
~
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=<任意のデータベース名>
DB_USERNAME=root
DB_PASSWORD=

AppServiceProvider.phpの編集

***\XAMPP\htdocs\<任意のプロジェクト名>\app\ProvidersにあるAppServiceProvider.phpを編集

use Illuminate\Support\Facades\Schema; //追加

~

 public function boot()
    {
        Schema::defaultStringLength(191); //追加
    }

PHPmyadminでデータベースの作成

127.0.0.1/phpmyadminにアクセスして.envに設定した名前のデータベース(utf8_general_ci)を作成

Voyager関連のデータベース構築

php artisan voyager:install

Voyagerアカウントの作成

php artisan voyager:install --with-dummy

上記実行後、下記へアクセスしてください。

http://localhost:8000/admin

email: admin@admin.com
password: password

つまづいたところ

Voyagerインストール時のエラー

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - tcg/voyager 1.1.x-dev requires intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, 2.4.1, 2.4.2, 2.4.x-dev].
    - tcg/voyager 1.x-dev requires intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, 2.4.1, 2.4.2, 2.4.x-dev].
    - tcg/voyager v1.1.0 requires intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, 2.4.1, 2.4.2, 2.4.x-dev].
    - tcg/voyager v1.1.1 requires intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, 2.4.1, 2.4.2, 2.4.x-dev].
    - tcg/voyager v1.1.10 requires intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, 2.4.1, 2.4.2, 2.4.x-dev].
    - tcg/voyager v1.1.2 requires intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, 2.4.1, 2.4.2, 2.4.x-dev].
    - tcg/voyager v1.1.3 requires intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, 2.4.1, 2.4.2, 2.4.x-dev].
    - tcg/voyager v1.1.4 requires intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, 2.4.1, 2.4.2, 2.4.x-dev].
    - tcg/voyager v1.1.5 requires intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, 2.4.1, 2.4.2, 2.4.x-dev].
    - tcg/voyager v1.1.6 requires intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, 2.4.1, 2.4.2, 2.4.x-dev].
    - tcg/voyager v1.1.7 requires intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, 2.4.1, 2.4.2, 2.4.x-dev].
    - tcg/voyager v1.1.8 requires intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, 2.4.1, 2.4.2, 2.4.x-dev].
    - tcg/voyager v1.1.9 requires intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, 2.4.1, 2.4.2, 2.4.x-dev].
    - intervention/image 2.4.x-dev requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
    - intervention/image 2.4.2 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
    - intervention/image 2.4.1 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
    - intervention/image 2.4.0 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
    - Installation request for tcg/voyager ^1.1 -> satisfiable by tcg/voyager[1.1.x-dev, 1.x-dev, v1.1.0, v1.1.1, v1.1.10, v1.1.2, v1.1.3, v1.1.4, v1.1.5, v1.1.6, v1.1.7, v1.1.8, v1.1.9].

  To enable extensions, verify that they are enabled in your .ini files:
    - C:\Users\1300793\Documents\XAMPP\php\php.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, reverting ./composer.json to its original content.

エラーメッセージに「requires ext-fileinfo」とあるので、extensionが不足していたようです。
php.iniの設定でextensionを有効化して解決してます。

上記エラーの後に再度Voyagerインストールしようとすると、「データベースがすでに存在します」的なエラーがでるので
php myadmin上でテーブルを全削除してください。

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away