-1

How can i start project cloned from bitbucket, based on Yii2, on my localhost? Composer is installed. When i clone it, composer update give me nothing. composer create-project --prefer-dist yiisoft/yii2-app-basic inside this project dont work, with error "folder is not empty". When i use this command composer create-project --prefer-dist yiisoft/yii2-app-basic without clone rep, its work good, and i cant clone in just created folder? How i can run cloned yii2 project on my localhost? Help pls. Sorry for my grammar. Error after composer update (install) enter image description here Repository content. enter image description here

Pluggins in install-plugins.bat

`php composer.phar require --prefer-dist mihaildev/yii2-ckeditor "*"

php composer.phar require kartik-v/yii2-widget-select2 "@dev"

php composer.phar require kartik-v/yii2-widget-datetimepicker "*"

php composer.phar require --prefer-dist yiisoft/yii2-imagine

php composer.phar require zelenin/yii2-slug-behavior "~1.5.1"

php composer.phar require --prefer-dist moonlandsoft/yii2-phpexcel "*"

php composer.phar require guzzlehttp/guzzle

php composer.phar require electrolinux/phpquery

UPD: Screen repository enter image description here

Juka Chu
  • 29
  • 2
  • `composer install` will install packages, you need this if you cloned a repo. What do you mean by `composer update` gives me nothing? `composer update` should also work. – Raul Sauco Jan 10 '21 at 18:07
  • @RaulSauco its doesnt. It tell me to init composer.json. And when i init it, and after - update or install. Nothing happens. I can attach screens to my question – Juka Chu Jan 10 '21 at 18:44
  • 1
    The project you cloned should have a `composer.json` file. – Raul Sauco Jan 10 '21 at 18:53
  • Without this file i cant start this project? – Juka Chu Jan 10 '21 at 18:57
  • That file installs the dependencies that are needed to run the project, are you sure the file is not in the repository you cloned, that seems unusual. You could still "fix" the issue, but the file really should be there. If you want to "fix" the issue manually (not recommended), go to the yii2 repository and copy the [composer.json from there](https://github.com/yiisoft/yii2-app-basic/blob/master/composer.json) into your project. Then `composer install` will run. Start using your project and when you get errors install the dependency causing them. – Raul Sauco Jan 10 '21 at 19:01
  • I'm update my question, added plugins in file `install-pluggins.bat`. Think its little part of all dependencies in project, but after this install - dont help too. I will try now yout method. Will attach screen from bitbucket repository – Juka Chu Jan 10 '21 at 19:05
  • Please share more details. If there is no `composer.json`, you cannot use composer on this project. You should rather ask the creator of that project why he didn't leave any information about how to run it in the Readme or any other file – Nico Haase Jan 11 '21 at 07:24

1 Answers1

1

It seems like, for some reason, the publisher of the repository added the dependencies to an extra file instead of them being added to the composer.json the usual way.

You can deal with this a couple of ways, both should give you the same results.

Option 1:

  1. Install the Yii2 app into a new folder:
composer create-project --prefer-dist yiisoft/yii2-app-basic
  1. Clone the repository you want to use into another folder.
  2. Drag&drop the contents of the cloned repository into the Yii2 folder, it will overwrite the Yii2 files, preserving the ones that don't change and adding the ones that don't exist.
  3. Add the extra dependencies, either by running the install-plugins.bat script or by hand running them one by one in the console.

Your project should be runnable now.

Option 2:

  1. Clone the repository you want.
  2. Copy the Yii2 composer.json into the root folder of the repository.
  3. Run composer install
  4. Add the extra dependencies, either by running the install-plugins.bat script or by hand running them one by one in the console.

Either way should give you the same results, you will end up having a vendor folder in the root of your project with all the dependencies, specified by composer.json and composer.lock that you need to run the project.

Raul Sauco
  • 2,645
  • 3
  • 19
  • 22
  • Thanks. Its works. But another problem) They dont give me data-base ) And project dont start correct. They said "make on our server" And i got another question. Hard to build question correctly. How to make changes on site with only bitbucket? Without starting on my localhost? Only on browser devTools, then copy and paste in styles file on bitbucket repository? Or what? I dont know, sorry for annoying – Juka Chu Jan 11 '21 at 09:23