Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Building Websites with PHP Slim Basics & Twig Templates Installing The Slim Framework

Nikhil Khandelwal
Nikhil Khandelwal
9,371 Points

None of my composer commands like init, composer require etc are working in my local machine. I am using MAMP.

Nikhils-MacBook-Air:Pro Nikhil$ composer require slim/slim -bash: composer: command not found Nikhils-MacBook-Air:Pro Nikhil$ composer init -bash: composer: command not found

Carl Mungazi
Carl Mungazi
9,071 Points

Try writing php composer.phar init etc. I think you have to configure something on your local machine to allow you to write 'composer' by itself.

Also, I assume you are working out of the directory in which you installed composer?

Nikhil Khandelwal
Nikhil Khandelwal
9,371 Points

Hey thanks Carl.... I wasted 8 hours searching for the solution on net.... Your solution worked. :)

Carl Mungazi
Carl Mungazi
9,071 Points

Glad to hear that! I had the same problem last night and it took me a while to figure it out.

1 Answer

You will need to install your composer through your plugin manager or package control then it will be added to your tools which you can then use the init and then add dependency. i used it will phpstorm this way and it works fine. kindly let's know what code editor or IDE you are using on your MAMP Nikhil Khandelwal