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

Using composer how can you add includes to your project in php

How can we add includes to our php project when using composer?

3 Answers

Kevin Korte
Kevin Korte
28,149 Points

Well you can just require Composer's autoloader, and Composer will handle the rest. Your dependencies get pulled in almost like magic.

It would look something simply like require LINK_TO_VENDOR . '/vendor/autoload.php'

You can also just simply require whatever you need from your dependencies folder that Composer brought it. I just like using the autoloader method, which will be in the vendor folder.

Official Docs: https://getcomposer.org/doc/01-basic-usage.md#autoloading

Thank you very much it was so helpfull

Thank you very much it was so helpfull