Supported Versions: PHP 5 >= 5.2.1, PHP 7, PHP 8
Returns directory path used for temporary files
<?php sys_get_temp_dir(): string
<?php return false;
}
$tmpFile = tempnam(sys_get_temp_dir(), '');
$script = $tmpFile.'.vbs';
rename($tmpFile, $script);
<?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 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 $minSpaceFree = 1024 * 1024;
if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
|| (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
|| (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
) {
$io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
}
<?php $sourcePath = realpath('.');
} else {
$sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
$filesystem->ensureDirectoryExists($sourcePath);
try {
<?php }
$tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
$filesystem->ensureDirectoryExists(dirname($tempTarget));
$archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes(), $ignoreFilters);
<?php try {
$gitUtil->runCommand(function ($url) {
return 'git ls-remote --heads -- ' . ProcessExecutor::escape($url);
}, $url, sys_get_temp_dir());
} catch (\RuntimeException $e) {
return false;
}
<?php $config = new Config();
}
if (!$config->has('home')) {
$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'cmptest-'.md5(uniqid('', true));
$config->merge(array('config' => array('home' => $tmpDir)));
}
<?php try {
$loop = new Loop($this->httpDownloader);
$promise = $downloader->download($this->package, $path = sys_get_temp_dir().'/composer-zip-test');
$loop->wait(array($promise));
$downloader->install($this->package, $path);
<?php $target = $this->getTargetName($package, 'tar');
$this->assertFileExists($target);
$tmppath = sys_get_temp_dir().'/composer_archiver/'.$this->manager->getPackageFilename($package);
$this->assertFileDoesNotExist($tmppath);
unlink($target);
<?php $this->assertFileExists($target);
$tmppath = sys_get_temp_dir().'/composer_archiver/'.$this->manager->getPackageFilename($package);
$this->assertFileDoesNotExist($tmppath);
unlink($target);
<?php $this->setupDummyRepo($files);
$package = $this->setupPackage();
$target = sys_get_temp_dir().'/composer_archiver_test.zip';
$archiver = new ZipArchiver();
<?php {
$json = $this->createJsonFileMock();
$repoDir = realpath(sys_get_temp_dir()).'/repo_write_test/';
$fs = new Filesystem();
$fs->removeDirectory($repoDir);
<?php $fs = new Filesystem();
$fs->removeDirectory(sys_get_temp_dir() . '/composer-test');
$process = $this->getProcessExecutorMock();
$process->expects(array(
<?php public static function getUniqueTmpDirectory()
{
$attempts = 5;
$root = sys_get_temp_dir();
do {
$unique = $root . DIRECTORY_SEPARATOR . uniqid('composer-test-' . rand(1000, 9000));