Laravel: How to include file from Vendor folder in Laravel

laravel, php, youtube-analytics

Solution

From where do you want to include that file ?

Place a reference to your file in composer.json autoload object:

"autoload": {
    "files":["your_file_path"]
}

Run composer dumpautoload, and you'll have your file :)

Problem

I am trying to include the YouTube Analytics Service of Google but I can not access it through the Vendor folder. ``` include(app_path.'path/to/analytics/Google_YoutubeAnalyticsService.php') ``` It is not working, because it defaults to the App folder. How can I get out of the App folder and into the Vendor folder (where the YouTube Analytics file is at)? The error is { include(C:\xampp\htdocs\mysite\app/path/to/analytics/Google_YoutubeAnalyticsService.php): failed to open stream: No such file or directory

Original source