Install yii2-nav-x

as I install an extension manually yii 2

for example the extension yii2-nav-x

Use composer, follow the instructions. Really. Why make it hard on yourself?

Yes use composer.

In you example package yii2-nav-x is one of the kartik-v extension.

kartik-v has divided its extension in several package so common base code is better handled.

yii2-nav-x is one of the complex extension and depends on kartik-v/yii2-dropdown-x which depends on yii2-krajee-base and so on…

So already handling dependencies in this case is a pain in the ass.

Composer will take care for all of this in you behalf. And in future composer will take care of update as well.

thanks for the answers

First installed composer as shown in the image

Imagen 1

second try to install the extension

Imagen 2

At first I suggest you a little facility to use composer:

make a little script in /usr/bin and call it composer so you can call it anywhere like a normal command

In your case inside this script put the following:


php /usr/local/bin/composer "$@"

This allow you to type just composer at command line without php and specify the path, big time save as you will use composer often.


Going back to you problem:[/b]

At first you must create your yii2 project


this will create a yii2 project skeleton, composer.json file included

Once a project is created all other package are requirement of the project, so within your project directory you run

composer require kartik-v/yii2-nav-x "dev-master"

require add yii2-nav-x to your composer.json, download it and its dependencies and install them under vendor directory

Junior Member

if I give access to my servidorme Might help ?

I get this error

You need to read the docs, man…

use kartik\nav\NavX;

echo NavX::widget([ //

thanks for the help and I worked, because I get descuadrado the menu