file_exists

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Checks whether a file or directory exists
file_exists(string $filename): bool
            $filePath

        
);



        if (
file_exists($downloadPath)) {

            
unlink($downloadPath);

        }
        $zip = new ZipArchive();

        
$resource $zip->open($filePath);



        if (!
file_exists($unzipPath)) {

            
mkdir($unzipPath0755true);

        }
            $filePath

        
);



        if (
file_exists($downloadPath)) {

            
unlink($downloadPath);

        }
        $zip = new ZipArchive();

        
$resource $zip->open($filePath);



        if (!
file_exists($unzipPath)) {

            
mkdir($unzipPath0755true);

        }
$appRoot getenv('LAMBDA_TASK_ROOT');



if (
getenv('BREF_DOWNLOAD_VENDOR')) {

    if(! 
file_exists('/tmp/vendor') || ! file_exists('/tmp/vendor/autoload.php')) {

        require_once 
'/opt/bref/breftoolbox.php';



        
\Bref\ToolBox\BrefToolBox::downloadAndConfigureVendor();
            $filePath

        
);



        if (
file_exists($downloadPath)) {

            
unlink($downloadPath);

        }
        $zip = new ZipArchive();

        
$resource $zip->open($filePath);



        if (!
file_exists($unzipPath)) {

            
mkdir($unzipPath0755true);

        }
];

foreach (
$layers as $layer => $layerDescription) {

    
$file __DIR__ "/../export/$layer.zip";

    if (! 
file_exists($file)) {

        echo 
"File $file does not exist: generate the archives first\n";

        exit(
1);

    }
            $profile getenv('AWS_PROFILE') ?: 'default';

        }



        if (! 
file_exists('serverless.yml')) {

            
$io->error('No `serverless.yml` file found.');



            return 
1;
            return 1;

        }



        if (
file_exists('serverless.yml') || file_exists('index.php')) {

            
$io->error('The directory already contains a `serverless.yml` and/or `index.php` file.');



            return 
1;
            throw new Exception('You cannot provide both a function name and the --handler= option.');

        }



        if (
$config !== null && ! file_exists($config)) {

            throw new 
Exception("The serverless file '$config' does not exist.");

        }
        }



        if (
$file) {

            if (! 
file_exists($file)) {

                throw new 
Exception("The file '$file' does not exist.");

            }

            
$data file_get_contents($file);
    private function handlerFromServerlessYml(string $function, ?string $config): string

    
{

        
$file $config ?? 'serverless.yml';

        if (! 
file_exists($file)) {

            throw new 
Exception("No `serverless.yml` file was found to resolve function $function.\nIf you do not use serverless.yml, pass the handler via the `--handler` option: vendor/bin/bref local --handler=file.php\nIf your serverless.yml file is stored elsewhere, use the `--config` option: vendor/bin/bref local --config=foo/serverless.yml");

        }
    {

        
clearstatcache(falseself::SOCKET);



        return 
file_exists(self::SOCKET);

    }



    private function 
eventToFastCgiRequest(HttpRequestEvent $eventContext $context): ProvidesRequestData
    private function killExistingFpm(): void

    
{


        if (! 
file_exists(self::PID_FILE)) {

            
unlink(self::SOCKET);

            return;

        }