Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113817 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 53143 invoked from network); 27 Mar 2021 18:01:00 -0000 Received: from unknown (HELO localhost.localdomain) (76.75.200.58) by pb1.pair.com with SMTP; 27 Mar 2021 18:01:00 -0000 To: internals@lists.php.net References: Date: Sat, 27 Mar 2021 17:57:32 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Posted-By: 87.81.129.66 Subject: Re: include vendor/autoload.php automatically From: marandall@php.net (Mark Randall) Message-ID: On 27/03/2021 16:52, Abdul Haq Sheikh wrote: > - On Index.php, php will automatically include 'vendor/autoload.php' > because the vendor directory exists. > - On Test.php, php will automatically include 'vendor/autoload.php' > because the vendor directory exists. > - On Classes/test2.php, since file is in sub directory and here vendor > directory doesn't exist, so php will not include 'vendor/autoload.php' Just an observation, but if you're doing vendor/autoload.php from your index.php page, and are not already doing custom include paths, then chances are you have your vendor directory publicly accessible and that is considered unwise.