ifusion
ifusion

Reputation: 2233

Certain folders and files missing when using composer to install silverstripe?

When I run $ composer install in the terminal to install silverstripe using the following composer.json file, it does not bring through certain folder/files. E.g it does not bring in the mysite folder or assets folder and things like the main .htaccess file...

{
    "name": "silverstripe/installer",
    "description": "The SilverStripe Framework Installer",
    "require": {
        "php": ">=5.3.2",
        "silverstripe/cms": "3.2.1",
        "silverstripe/framework": "3.2.1",
        "silverstripe-themes/simple": "*"
    },
    "minimum-stability": "dev"
}

Where as if I run the create project command from the silverstripe website it creates everything

E.g $ composer create-project silverstripe/installer /path/to/project 3.2.1

How can I bring everything in using my composer.json file?

Upvotes: 1

Views: 653

Answers (1)

Olli Tyynelä
Olli Tyynelä

Reputation: 576

There is a StackOverflow answer similar to this: Difference between require and install vs create-project in composer

The create-project in essence clones the following repository, which has the files and folders you are looking for: https://github.com/silverstripe/silverstripe-installer

It also has the composer.json file and runs the composer install after the cloning has finished.

So that is a base you can start your work on.

Note, you wouldn't want composer install to replace your .htaccess as that is something you edit per project (for redirects and things like that).

We have our own fork, of sorts, of the installer that contains our commonly used SilverStripe extensions in the composer.json already.

In our "base repo" we have:

  • .htaccess with samples of various redirects that you should have (forcing www, exceptions for development domains, etc)
  • Our own "project" base template that contains loads of helpers
  • Our commonly used SilverStripe extensions in the composer.json

We start our SilverStripe project by forking the base repository and then cloning that. We then run composer install on it and then start working on the project. We then commit the changes to our forked repository that relates to the project.

Also, in our repository we have vagrant file to start up a dev machine with all the goodies.

Upvotes: 3

Related Questions