create extension with gii Extension Generator

Hi I wanted to create an extension with the gii Extension Generator.

And wanted to test it only "locally".

Therefore i filled the fields with this values:

vendor: myself

packagename: yii2-foobar

namespace: myself\foobar\

type: yii2-extension

keywords: yii2,extension

title: foobar

output path: @vendor/myself

Because i wanted to test it only locally and not on git i added this to my composer.json file.




"repositories":[

    {

        "type": "git",

        "url": "https://path.to/your/repo"

    }

]



and replaced the url with the recommended value


Note: You may use the url file://D:\wamp\www\yii2\my_app\vendor\myself/yii2-foobar for testing.

OK i fixed the \ with \\

"url" : "file://D:\\wamp\\www\\yii2\\my_app\\vendor\\myself/yii2-foobar"

But always getting errors on composer update




 [Composer\Repository\InvalidRepositoryException]

 No valid composer.json was found in any branch or tag of file://D:/wamp/www/yii2/my_app/vendor/myself/yii2-foobar, could not load a package from it.



The path is correct and is the generated composer.json of the extension where i can’t find a problem.

Any hints?

Maybe the path is not correct on Windows Systems?

i also tried




"url" : "file://D:\\wamp\\www\\yii2\\my_app\\vendor\\myself\\yii2-foobar"

"url": "file://./vendor/myself/yii2-foobar"

"url" : "D:\\wamp\\www\\yii2\\my_app\\vendor\\myself/yii2-foobar"

"url" : "./vendor/myself/yii2-foobar"

"url" : "/vendor/myself/yii2-foobar"

"url" : "file://D:\\wamp\\www\\yii2\\my_app\\vendor\\myself/yii2-foobar"



So what is the correct path under windows or what could cause the problem?

regards Horizons

Have you committed the files into the local repository? composer only considers files under version control because it checks via git and not via file system.

What? it is not possible to "test" local files without any git or cvs?

If i look at this thread it seems to also work locally.

http://www.yiiframework.com/forum/index.php/topic/51843-local-extensions/

edit solved

i had several problems.

  1. my editor “gitpad” wans’t correctly installed in my “portable” github version…

  2. i shouldn’t have changed the output path to @vendor/myself and leave it to @app/runtime/tmp-extensions

  3. i did’t understand the extension generator that i have to call the git commands if i only want a local extension.

git init

git add -A

And also have to enter at least "something" in git commit file and save which opens on commit.

git commit

afterwards extend my composer.json with




"repositories":[

        {

            "type": "git",

            "url" : "file://D:\\wamp\\www\\yii2\\myapp\\vendor\\myself\\yii2-foobar"

        }

    ]



and call




composer.phar require myself/yii2-foobar:dev-master



to install the local git version from my @app/runtime/tmp-extensions to my @vendor\myself directory.

I really thought this would be not that difficult to develop only locally and upload it to some git account at a later state.

But I must say that i don’t have much git experience so far.