Laravel: how to include a file from the Vendor folder in Laravel

therefore, I’m trying to enable Google service in Google Analytics, but I can’t access it through the Vendor folder. include(app_path.'path/to/analytics/Google_YoutubeAnalyticsService.php')does not work because the application folder is used by default. How can I exit the App folder and the Vendor folder where the YouTube Analytics file is located. Scrapped error: include(C:\xampp\htdocs\mysite\app/path/to/analytics/Google_YoutubeAnalyticsService.php): failed to open stream: No such file or directory. You must exit this application folder. Thanks for any help!

+4
source share
2 answers

Where do you want to include this file?

Put a link to your file in the composite .json startup object:

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

Run the dumpautoload composer and you will have a file :)

+7

, base_path ,

echo base_path() . '/vendor';

.

Laravel

, laravel, ( 4.2).

+2

Source: https://habr.com/ru/post/1526116/


All Articles