Yii 2.0: yii2-ip2location Extension Installation


I am using the basic template and following the installation instruction given on :

yiiframework.com/extension/yii2-ip2location extension and Official website; I don’t know How I can install the extension since I don’t find the folder in which they recommending to install.

Please I need your help to know how I can install this extension. Thanks

My guess is that if the directory is not present, create it.

But, I would avoid Yii 2 extensions that does not have Composer support.

It smells bad.

If you can find an extension on Packagist/YiiGist that is installable by Composer, use it.

My personal opinion is that if the “developer” of that extension couldn’t be bothered to create a proper extension, I wonder how many other things that only been implemented half-way?

I am still confused because I don’t know wich instruction to follow; the one of official website or of Yii Framework; and in which root folder should I create these directories they require.

The instructions on the official site is for Yii 1, unfortunately. So don’t use that.

Follow this link:


What do you need from ip-location ?

I think you could use the extension from Kartik-v maybe?

I need to get the client timezone; I choose it because it handles directly UTC and DST timezone; but if you have anything good to propose me; It is ok.

This looks like it does the job:


At least for grabbing the timezone from the user location.

Thanks; installation is still prompting an error; I am trying to figure out!!!

The "yiisoft/yii2-composer" plugin requires composer-plugin-api 1.0.0, this WILL break in the future and it should be fixed ASAP (require ^1.0 for example).

I am just scared of the solution I found to solve it from this post

[s]It is requiring ^1.0 in master - how have you been upgrading?

[/s]OK, just do what the accepted answer says.

The fxp composer asset plugin is a major pain in certain parts of the anatomy…

You will probably remove and reinstall it more than once.

Just do it :)

Post any issues you might be having, and we’ll help you out.

Remove the vendor folder from your composer installation

It’s not working still getting the same error;

Describe exactly what you did.

to solve the error "The "yiisoft/yii2-composer" plugin requires composer-plugin-api 1.0.0, this WILL break in the future and it should be fixed ASAP (require ^1.0 for example)." i do these steps:

  • edit composer.json in the home composer directory


    "require": {

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



  • run

composer update

  • and now retry to install every composer package you want

 "require": {

        "php": ">=5.4.0",

         "fxp/composer-asset-plugin": "~1.1.1",

        "yiisoft/yii2": ">=2.0.5",

        "yiisoft/yii2-bootstrap": "*",

        "yiisoft/yii2-swiftmailer": "*",

        "dektrium/yii2-user": "v0.9.5",

        "kartik-v/bootstrap-fileinput": "dev-master",

        "yiisoft/yii2-imagine": "dev-master",

        "kartik-v/yii2-widget-fileinput": "*",

        "sjaakp/yii2-illustrated-behavior": "dev-master",

        "yiisoft/yii2-jui": "* 2.0.4",

        "kartik-v/yii2-datecontrol": "dev-master",

        "kartik-v/yii2-widgets": "dev-master"



That’s what is in composer.json but I am still getting the same error; line two is what I added to try Federico Benedetti idea.

What I suspected…

You should leave your local composer.json alone.

Remove that line you added. Delete the ‘vendor’ directory.

Then go to your global Composer directory - that is ~/.composer on Linux - and delete the ‘fxp’ directory in the ‘vendor’ directory there.

Open the composer.json present in that global Composer directory and remove the line about the asset plugin.

If that is the only line, then it is easier to just remove the entire ~/,composer directory (rm -rf ~/.composer)

Then, you can issue a proper composer global require fxp/…

After a successful global installation of the asset plugin, run ‘composer install’ in your project.

I am on windows and don’t know where the global composer is supposed to be and it directory.

It is in


I get it thanks;

Remove that line you added. Delete the 'vendor' directory.

Do you mean my vendor directory in the project or global composer vendor directory? and I have that line only


Then, you can issue a proper composer global require fxp/...

Do you mean I execute the command

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


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



Remove the ‘fxp’ directory in ‘vendor’. (in your global composer dir)

Remove the line in global composer.json (in your global composer dir)

Then run:

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

Once that successfully completes:

Go to your project dir and remove the ‘vendor’ dir.

Open project composer.json and remove that composer plugin line you added to it.

Run composer install.

Enjoy and be happy :)