yiisoft / yii2-gii

Yii 2 Gii Extension
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
202 stars 192 forks source link

Configure/Enable Gii #127

Closed zeroth closed 8 years ago

zeroth commented 8 years ago

Hello There, I want to user Gii in my Yii app and I am getting error

Invalid Parameter – yii\base\InvalidParamException
The file or directory to be published does not exist: /home/abhishek/Work/Yii/lpdapi/vendor/yiisoft/yii2/gii/assets

I have configure my yii application separately following is my config.

├── api
│   └── controllers
├── composer.json
├── composer.lock
├── config
│   └── config.php
├── init
│   ├── assets
│   └── index.php
// composer.json
{
    "name": "lpdapi/mainproject",
    "require": {
        "yiisoft/yii2": ">=2.0.5"
    },
    "require-dev": {
        "yiisoft/yii2-gii": "*"
    },
    "authors": [
        {
            "name": "Abhishek Patil",
            "email": "abhishek@zeroth.me"
        }
    ]
}
//config.php
<?php

$config = [
    'id' => 'basic',
    'basePath' => dirname(__DIR__).'/api',
    'bootstrap' => ['gii'],
    'modules' => [
        'gii' => [
            'class' => 'yii\gii\Module',
        ],
        // ...
    ],

];
return $config;
//init\index.php
<?php

// comment out the following two lines when deployed to production
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

require(__DIR__ . '/../vendor/autoload.php');
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');

$config = require(__DIR__ . '/../config/config.php');

(new yii\web\Application($config))->run();

Am I missing something?

SilverFire commented 8 years ago

It seems that you don't have vendor/yiisoft/extensions.php, where the alias @yii/gii must be defined.

What is your composer version?

zeroth commented 8 years ago

I added 'extensions' => require(DIR . '/../vendor/yiisoft/extensions.php'), to config file and my composer version is Composer version 1.0-dev (42f49b3b979b7039d138e260d9087e93e46d715a) 2016-01-16 19:47:49

After adding the extensions to config now its looking for wrong path The file or directory to be published does not exist: /home/abhishek/Work/Yii/lpdapi/api/vendor/bower/jquery/dist

SilverFire commented 8 years ago

The file or directory to be published does not exist: /home/abhishek/Work/Yii/lpdapi/api/vendor/bower/jquery/dist

You don't have FPX plugin.

composer global require "fxp/composer-asset-plugin:~1.1.1"

zeroth commented 8 years ago

I have installed it globally ( composer.phar global require "fxp/composer-asset-plugin:~1.0") do I need it locally ?

SilverFire commented 8 years ago

No. Make sure that version is 1.1.1 now composer global show -i

zeroth commented 8 years ago

composer global show -i Changed current directory to /home/abhishek/.composer fxp/composer-asset-plugin v1.1.1 NPM/Bower Dependency Manager for Composer

zeroth commented 8 years ago

I have reopened the issue here https://github.com/yiisoft/yii2-gii/issues/128 with updated details please check

SilverFire commented 8 years ago

It was not necessary, but okay, let's move there.