{"id":15282107,"url":"https://github.com/salamek/nette-tempnam","last_synced_at":"2026-04-02T01:18:41.670Z","repository":{"id":62539497,"uuid":"98329086","full_name":"Salamek/nette-tempnam","owner":"Salamek","description":"Create files in %tempDir%/tempnam","archived":false,"fork":false,"pushed_at":"2022-03-04T14:23:21.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T14:11:30.103Z","etag":null,"topics":["nette","temporary"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Salamek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-25T16:45:31.000Z","updated_at":"2022-03-02T13:20:59.000Z","dependencies_parsed_at":"2022-11-02T16:00:32.089Z","dependency_job_id":null,"html_url":"https://github.com/Salamek/nette-tempnam","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Salamek%2Fnette-tempnam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Salamek%2Fnette-tempnam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Salamek%2Fnette-tempnam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Salamek%2Fnette-tempnam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Salamek","download_url":"https://codeload.github.com/Salamek/nette-tempnam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245111952,"owners_count":20562512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nette","temporary"],"created_at":"2024-09-30T14:18:55.370Z","updated_at":"2025-12-29T20:26:46.879Z","avatar_url":"https://github.com/Salamek.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nette tempnam\n\nThis is a simple tempnam extension for [Nette Framework](http://nette.org/)\nIt creates temp files in %tempDir%/tempnam\n\n## Why ?\nSometines you just need to create tempfile such as PDF, Latte templates etc... and you dont want to put them into `sys_get_temp_dir()` (/tmp) and keep them in your Nette project %tempDir%... or just acces same temp file multiple times\n\n## Instalation\n\nThe best way to install salamek/nette-tempnam is using  [Composer](http://getcomposer.org/):\n\n\n```sh\n$ composer require salamek/nette-tempnam:@dev\n```\n\nThen you have to register extension in `config.neon`.\n\n```yaml\nextensions:\n    tempnam: Salamek\\Tempnam\\DI\\TempnamExtension\n```\n\nIf you wish to change tempnam path just add this to your config:\n\n```yaml\ntempnam:\n   tempDir: %tempDir%/tempnam\n```\n\n\n## Usage example\n\n```php\n\n/** @var Salamek\\Tempnam\\Tempnam @inject */\npublic $tempnam;\n\n$key = 'my_tempnam_key_1'; // Lets say ID of record in database\n$data = 'My File COntent'; // Lets say record from database we want as file\n$updatedAt = new \\DateTime('YYYY-mm-dd'); // Lets say updatedAt column from database to expire tempnam file when record in database is changed\n\n// Load temFile Path or null\n$tempFile = $this-\u003etempnam-\u003eload($key, $updatedAt);\n\n\nif ($tempFile === null)\n{\n    $tempFile = $this-\u003etempnam-\u003esave($key, $data, $updatedAt);\n}\n\necho file_get_contents($tempFile); // My File COntent\n\n```\n\n## Methods\n\n```php \n$this-\u003etempnam-\u003egetTempDir(); //Returns tempDir\n$this-\u003etempnam-\u003eremove($key); //Removes tempnam file by its $key\n$this-\u003etempnam-\u003eload($key, \\DateTimeInterface $updatedAt = null); //Returns tempnam file path by its key if updatedAt matches or returns null\n$this-\u003etempnam-\u003esave($key, $data, \\DateTimeInterface $updatedAt = null) //Saves tempnam file by $key with $data content, returns tempnam path\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalamek%2Fnette-tempnam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsalamek%2Fnette-tempnam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalamek%2Fnette-tempnam/lists"}