5

I try to learn composer, now I want to include (zurb) foundation, so I added "require": {"zurb/foundation": "v5.2.2"} to the composer.json file. After running composer.phar update, I can see that there are some files added to the folder /vendor/zurb/foundation.

But I have no clue how to continue, could anybody please advise how I can start building my web-app now? How do I get it to use the css and js files that are needed for foundation?

I already included the file vendor/autoload.php to my index.php, but that doesn't seem to be enough.

I already built multiple web-sites and apps using foundation, but always "manual", then I just include the right css and js files to the header and footer of the page. Now I just don't know where to start.

thanks for your help.

Noweem
  • 123
  • 1
  • 10
  • 1
    Composer is for PHP packages. Front-end packages should be included using [Bower](http://bower.io/) (the package manager for font-end packages). You can also take a look at the [component installer](http://robloach.github.io/component-installer/) if you don't want to use bower – Wouter J Apr 17 '14 at 21:58
  • 1
    Thanks for your comment, but why is it then available via composer when that doesn't do anything? or am I seeing it wrong? – Noweem Apr 18 '14 at 22:41
  • 3
    because some people thought Composer was the answer to everything... :) – Wouter J Apr 19 '14 at 10:07
  • haha, ok, thank you :-) – Noweem Apr 19 '14 at 11:41

1 Answers1

3

Check this question first to get the basics: NPM/Bower/Composer - differences?.


Then, if you decide to go with Composer for PHP and Bower for front-end libraries, follow this:

  1. Install Bower using sh $ npm install -g bower (you'll need Node.js and npm first)
  2. Configure Bower for you front-end packages (visit Bower docs for more information)

    {
      "name": "MyProject",
      "dependencies": {
        "foundation": "*"
      }
    }
    
  3. Hook Bower to Composer adding this to your composer.json

    "scripts": {
      "post-install-cmd": [
        "bower install"
      ],
      "post-update-cmd": [
        "bower install"
      ],
    }
    

Now every time you hit composer update (or install), bower components get updated as well!

Community
  • 1
  • 1
Bugs Bunny
  • 1,992
  • 1
  • 23
  • 27