Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113813 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 44866 invoked from network); 27 Mar 2021 16:56:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Mar 2021 16:56:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 82C4D1804E3 for ; Sat, 27 Mar 2021 09:52:56 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-vs1-f50.google.com (mail-vs1-f50.google.com [209.85.217.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 27 Mar 2021 09:52:52 -0700 (PDT) Received: by mail-vs1-f50.google.com with SMTP id u29so1191232vsi.12 for ; Sat, 27 Mar 2021 09:52:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=2cBWtb6WdjO545H82BdGdg8GG0aHp2hc42+sDZ3n6go=; b=bqZOSG8OSG0kRD6cw38zn5aLtAFO01QAn/Mr6MlXRQSve8YCbz97McwXyH8di2oTA+ 0zsiAJNqnxvOzecp5epW+LxOEzSDepYf8r6oi/9B+SPQ1n7aOcvix+xyxZvG/OtNXOzP QXq7NkSGSCvftzcwDm6huvtx8UOBQzZ8Emb/Yb+L9eJSM57LsYgI+wU3k3OCAq334il8 1G2F0FDslOlp0MrikO5civCQ5YyH7gR3Eujohm+PZugK0X8kr5zWAQMNGroqosdFwH+5 duy4Tmcpo3hQcy/szeWu2N7ijw/f/oxlWk7I3x2qS7CDGUBDBgFivoDc5f2HDAE3XpG0 AN8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=2cBWtb6WdjO545H82BdGdg8GG0aHp2hc42+sDZ3n6go=; b=CM5AUOlZJLdpygo+NkIMtxOitnS0Mq1iut3Ja7VPkVTSfGB1E+94DNFmBhYs7iMI9m VnZLJESLFaL3qJ2nO8rm5nPMhrp4+iPNG8qleLtBtsIIjONw3YVkEZq0W0gaQF7N2r12 z/PEovKRNY5Fczcnp5QmQoWWABoOvexAQKeYBgxayu9TnBeZ04l7s9eUh/FBwTN/zdpY W7jZfhFCfgGiTGNb1LGwz0mhhnAa1RlOoQHKQRefQd1HgHjwb/19ewuJq8dUIKeqP0b+ kTC2rgs8ffJkx4tZ+Rf9ZML1aoQZyPW89ruZWacXRyUY2jLRU/nNRWis1qD5fxRrZv/1 ZAvA== X-Gm-Message-State: AOAM533rbuGiqJJuVmmLCcDMyB79DNy/ta3qQXtTY8otyN0NVREJM/sO mZ/GDMfyy9dlANBjcshdjGdPEGERx59bWJ3WFyaWtZM++0X0gQ== X-Google-Smtp-Source: ABdhPJy09JLV1f84gG8z4345jeuv40b2NJ8zF3cpGbj2yrTuBzipJVWWcJc0iurSaM9xIhL1AohE3C/qJ7Ru8+vSXTw= X-Received: by 2002:a67:d994:: with SMTP id u20mr3744105vsj.29.1616863970243; Sat, 27 Mar 2021 09:52:50 -0700 (PDT) MIME-Version: 1.0 Date: Sat, 27 Mar 2021 21:52:38 +0500 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary="00000000000098d4b405be877a61" Subject: include vendor/autoload.php automatically From: khaweronline@gmail.com (Abdul Haq Sheikh) --00000000000098d4b405be877a61 Content-Type: text/plain; charset="UTF-8" If we want to use composer packages, we have to include 'vendor/autoload.php', and if we don't have a front controller design pattern, we must include 'vendor/autoload.php' on every/most files. Why not to auto include 'vendor/autoload.php' file (if vendor folder exists)? * PHP will use include_once to include file Example Directory Structure: - Index.php (file) - Test.php (file) - Classes (folder) -- Classes/test2.php (file) - Vendor (folder) - 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' --00000000000098d4b405be877a61--