Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Deletes a file
<?php unlink(string $filename, ?resource $context = null): bool
<?php         if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)) {

            $filesystem->filePutContentsIfModified($includePathFilePath, $includePathFileContents);

        } elseif (file_exists($includePathFilePath)) {

            unlink($includePathFilePath);

        }

        $includeFilesFilePath = $targetDir.'/autoload_files.php';

        if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)) {
<?php         if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)) {

            $filesystem->filePutContentsIfModified($includeFilesFilePath, $includeFilesFileContents);

        } elseif (file_exists($includeFilesFilePath)) {

            unlink($includeFilesFilePath);

        }

        $filesystem->filePutContentsIfModified($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath));

        $checkPlatform = $config->get('platform-check') && !($this->platformRequirementFilter instanceof IgnoreAllPlatformRequirementFilter);
<?php         if ($checkPlatform) {

            $filesystem->filePutContentsIfModified($targetDir.'/platform_check.php', $platformCheckContent);

        } elseif (file_exists($targetDir.'/platform_check.php')) {

            unlink($targetDir.'/platform_check.php');

        }

        $filesystem->filePutContentsIfModified($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));

        $filesystem->filePutContentsIfModified($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $checkPlatform));
<?php                 $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);

                if (Preg::isMatch('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {


                    unlink($tempFileName);



                    $message = sprintf(

                        '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
<?php         }



        if ($repositories !== null && $addRepository && is_file('composer.lock')) {

            unlink('composer.lock');

        }



        $composer = Factory::create($io, null, $disablePlugins, $disableScripts);
<?php         if ($this->newlyCreated) {

            $io->writeError("\n".'<error>Installation failed, deleting '.$this->file.'.</error>');

            unlink($this->json->getPath());

            if (file_exists($this->lock)) {

                unlink($this->lock);

            }
<?php             $io->writeError("\n".'<error>Installation failed, deleting '.$this->file.'.</error>');

            unlink($this->json->getPath());

            if (file_exists($this->lock)) {

                unlink($this->lock);

            }

        } else {

            $msg = ' to its ';
<?php         }



        if (!$this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {

            @unlink($tempFilename);



            return 1;

        }
<?php                 copy($newFilename, $localFilename);

                @unlink($newFilename);

            } else {

                rename($newFilename, $localFilename);

            }
<?php         file_put_contents($script, $vbs);

        exec('"'.$script.'"');

        @unlink($script);




        if ($result = Filesystem::isReadable($localFilename) && (hash_file('sha256', $localFilename) === $checksum)) {
<?php         if ($result = Filesystem::isReadable($localFilename) && (hash_file('sha256', $localFilename) === $checksum)) {

            $io->writeError('<info>Operation succeeded.</info>');

            @unlink($newFilename);

        } else {

            $io->writeError('<error>Operation failed.'.$helpMessage.'</error>');

        }
<?php     public function compile($pharFile = 'composer.phar')

    {

        if (file_exists($pharFile)) {

            unlink($pharFile);

        }



        $process = new Process(array('git', 'log', '--pretty=%H', '-n1', 'HEAD'), __DIR__);
<?php             Silencer::call(function () use ($io) {

                $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());

                if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {

                    $io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir()));

                }

            });
<?php         if (file_exists($target)) {

            unlink($target);

        }



        try {
<?php                 }




                unlink($target);




                $phar->compress(static::$compressFormats[$format]);