{"id":18879722,"url":"https://github.com/loilo/storage-paths","last_synced_at":"2026-02-20T04:30:19.202Z","repository":{"id":62518845,"uuid":"197006512","full_name":"loilo/storage-paths","owner":"loilo","description":"🗄 Get OS-specific paths for storing your project's config, cache, logs etc.","archived":false,"fork":false,"pushed_at":"2020-12-23T23:08:19.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-31T03:12:37.916Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loilo.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":"2019-07-15T13:41:52.000Z","updated_at":"2020-12-23T23:08:21.000Z","dependencies_parsed_at":"2022-11-02T14:46:01.050Z","dependency_job_id":null,"html_url":"https://github.com/loilo/storage-paths","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fstorage-paths","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fstorage-paths/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fstorage-paths/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fstorage-paths/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loilo","download_url":"https://codeload.github.com/loilo/storage-paths/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239841742,"owners_count":19705981,"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":[],"created_at":"2024-11-08T06:39:04.226Z","updated_at":"2026-02-20T04:30:19.125Z","avatar_url":"https://github.com/loilo.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg alt=\"Storage Paths logo: a file cabinet with an open drawer which contains printed document\" src=\"storage-paths.svg\" width=\"196\" height=\"196\"\u003e\n\u003c/div\u003e\n\n# Storage Paths\n[![Tests](https://badgen.net/github/checks/loilo/storage-paths/master)](https://github.com/loilo/storage-paths/actions)\n[![Version on packagist.org](https://badgen.net/packagist/v/loilo/storage-paths)](https://packagist.org/packages/loilo/storage-paths)\n\nThis package yields OS-specific paths for storing your project's config, cache, logs etc. While the API has been adjusted for PHP, the research and opinionated fallbacks stem from the Node.js [env-paths](https://github.com/sindresorhus/env-paths) package by [Sindre Sorhus](https://github.com/sindresorhus).\n\n## Install\n```bash\ncomposer require loilo/storage-paths\n```\n\n## Usage\nExample for macOS:\n\n```php\nuse Loilo\\StoragePaths\\StoragePaths;\n\n$paths = StoragePaths::for('MyApp');\n\n$paths-\u003edata()   === '/Users/loilo/Library/Application Support/MyApp-php';\n$paths-\u003econfig() === '/Users/loilo/Library/Preferences/MyApp-php';\n$paths-\u003ecache()  === '/Users/loilo/Library/Caches/MyApp-php';\n$paths-\u003elog()    === '/Users/loilo/Library/Logs/MyApp-php';\n$paths-\u003etemp()   === '/var/folders/qh/z_hny67s57sfm_sxy1zynnkr0000gn/T/MyApp-php';\n```\n\n## API\n### Signature\n```php\nStoragePaths::for(string $name, array $options): StoragePathsInterface;\n```\n\n* `$name` — The name of your project. This is used to generate the paths, therefore it needs to be a valid filename.\n\n* `$options` — An (optional) associative array of options:\n  * `$options['suffix']`\n\n    **Type:** `string`\n\n    **Default:** `'php'`\n    \n    A suffix string appended to the project name to avoid naming conflicts with native apps.\n  * `$options['os']`\n\n    **Type:** `string`\n\n    **Default:** `PHP_OS_FAMILY`\n    \n    Override the operating system to generate paths for. Values correspond to the [`PHP_OS_FAMILY`](https://www.php.net/manual/reserved.constants.php#constant.php-os-family) constant.\n\n\u003e **Note:** Calling `StoragePaths::for()` only generates the path strings. It doesn't create the directories for you.\n\n### Result\nThe returned [`StoragePathsInterface`](src/StoragePathsInterface.php) provides access to the following storage methods:\n\n* `data()` — Directory for data files\n* `config()` — Directory for config files\n* `cache()` — Directory for for non-essential data files\n* `log()` — Directory for log files\n* `temp()` — Directory for temporary files\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floilo%2Fstorage-paths","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floilo%2Fstorage-paths","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floilo%2Fstorage-paths/lists"}