{"id":19810215,"url":"https://github.com/mathiasreker/php-chmod","last_synced_at":"2026-01-11T09:46:03.864Z","repository":{"id":53275867,"uuid":"521039565","full_name":"MathiasReker/php-chmod","owner":"MathiasReker","description":"php-chmod is a PHP library for easily changing file/directory permissions recursively.","archived":false,"fork":false,"pushed_at":"2024-11-12T05:01:47.000Z","size":128,"stargazers_count":10,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-05-01T08:34:14.600Z","etag":null,"topics":["chmod","directory","file","filepermissions","permissions","php"],"latest_commit_sha":null,"homepage":"https://github.com/MathiasReker/php-chmod","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MathiasReker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["MathiasReker"]}},"created_at":"2022-08-03T21:37:36.000Z","updated_at":"2025-01-30T10:56:55.000Z","dependencies_parsed_at":"2025-05-01T08:31:59.002Z","dependency_job_id":"a20ec687-a8c8-4e3d-9e77-88c39a102606","html_url":"https://github.com/MathiasReker/php-chmod","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/MathiasReker/php-chmod","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathiasReker%2Fphp-chmod","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathiasReker%2Fphp-chmod/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathiasReker%2Fphp-chmod/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathiasReker%2Fphp-chmod/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MathiasReker","download_url":"https://codeload.github.com/MathiasReker/php-chmod/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathiasReker%2Fphp-chmod/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263145837,"owners_count":23420678,"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":["chmod","directory","file","filepermissions","permissions","php"],"created_at":"2024-11-12T09:20:03.454Z","updated_at":"2026-01-11T09:46:03.857Z","avatar_url":"https://github.com/MathiasReker.png","language":"PHP","funding_links":["https://github.com/sponsors/MathiasReker"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003ePHP chmod\u003c/h1\u003e\n\n[![Packagist Version](https://img.shields.io/packagist/v/MathiasReker/php-chmod.svg)](https://packagist.org/packages/MathiasReker/php-chmod)\n[![Packagist Downloads](https://img.shields.io/packagist/dt/MathiasReker/php-chmod.svg?color=%23ff007f)](https://packagist.org/packages/MathiasReker/php-chmod)\n[![CI status](https://github.com/MathiasReker/php-chmod/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/MathiasReker/php-chmod/actions/workflows/ci.yml)\n[![Contributors](https://img.shields.io/github/contributors/MathiasReker/php-chmod.svg)](https://github.com/MathiasReker/php-chmod/graphs/contributors)\n[![Forks](https://img.shields.io/github/forks/MathiasReker/php-chmod.svg)](https://github.com/MathiasReker/php-chmod/network/members)\n[![Stargazers](https://img.shields.io/github/stars/MathiasReker/php-chmod.svg)](https://github.com/MathiasReker/php-chmod/stargazers)\n[![Issues](https://img.shields.io/github/issues/MathiasReker/php-chmod.svg)](https://github.com/MathiasReker/php-chmod/issues)\n[![MIT License](https://img.shields.io/github/license/MathiasReker/php-chmod.svg)](https://github.com/MathiasReker/php-chmod/blob/develop/LICENSE.txt)\n\n`php-chmod` is a PHP library for easily changing file/directory permissions recursively.\n\n\u003e ✅ Literal octal notation (0o) is supported\n\n### Versions \u0026 Dependencies\n\n| Version | PHP  | Documentation |\n|---------|------|---------------|\n| ^3.0    | ^8.1 | current       |\n\n### Requirements\n\n- php-extension `ext-mbstring`\n\n### Installation\n\nRun:\n\n```bash\ncomposer require mathiasreker/php-chmod\n```\n\n### Examples\n\nDry run:\n\n```php\n\u003c?php\n\nuse MathiasReker\\PhpChmod\\Scanner;\n\nrequire __DIR__ . '/vendor/autoload.php';\n\n$result = (new Scanner())\n    -\u003esetDefaultFileMode(0644)\n    -\u003esetDefaultDirectoryMode(0755)\n    -\u003esetExcludedFileModes([0400, 0444, 0640])\n    -\u003esetExcludedDirectoryModes([0750])\n    -\u003escan([__DIR__])\n    -\u003edryRun();\n\nvar_dump($result); // string[]\n```\n\nFix:\n\n```php\n\u003c?php\n\nuse MathiasReker\\PhpChmod\\Scanner;\n\nrequire __DIR__ . '/vendor/autoload.php';\n\n(new Scanner())\n    -\u003esetDefaultFileMode(0644)\n    -\u003esetDefaultDirectoryMode(0755)\n    -\u003esetExcludedFileModes([0400, 0444, 0640])\n    -\u003esetExcludedDirectoryModes([0750])\n    -\u003escan([__DIR__])\n    -\u003efix(); // void\n```\n\n### Documentation\n\n```php\n$result = new Scanner();\n```\n\n`setDefaultFileMode` sets the default file permission:\n\n```php\n$result-\u003esetDefaultFileMode(0644);\n```\n\n`setDefaultDirectoryMode` sets the default directory permission:\n\n```php\n$result-\u003esetDefaultDirectoryMode(0755);\n```\n\n`setExcludedFileModes` sets the allowed permissions for files. Files with these permissions will be skipped:\n\n```php\n$result-\u003esetExcludedFileModes([0400, 0444, 0640]);\n```\n\n`setExcludedDirectoryModes` sets the allowed permissions for directories. Directories with these permissions will be\nskipped:\n\n```php\n$result-\u003esetExcludedDirectoryModes([0750]);\n```\n\n`setExcludedNames` exclude files by a custom pattern. Glob and RegEx are supported:\n\n```php\n$result-\u003esetExcludedNames(['*.rb', '*.py']);\n```\n\n`setNames` includes files by a custom pattern and exclude any other files. Glob and RegEx are supported:\n\n```php\n$result-\u003esetNames(['*.php']);\n```\n\n`setExcludedPaths` excludes a list of file/directory paths:\n\n```php\n$result-\u003esetExcludedPaths(['first/dir', 'other/dir']);\n```\n\n`doExcludeFiles` excludes all files:\n\n```php\n$result-\u003edoExcludeFiles();\n```\n\n`doExcludeDirectories` excludes all directories:\n\n```php\n$result-\u003edoExcludeDirectories();\n```\n\n`scan` finds all the concerned files/directories:\n\n```php\n$result-\u003escan([__DIR__]);\n```\n\n`setPaths` sets paths of files/directories manually. This is an alternative to the scanner if you want to use a custom\nscanner:\n\n```php\n$result-\u003esetPaths($paths);\n```\n\n`dryRun` returns an array of the concerned files/directories:\n\n```php\n$result-\u003edryRun();\n```\n\n`fix` changes the concerned files/directories permissions to the default permission:\n\n```php\n$result-\u003efix();\n```\n\n### Roadmap\n\nSee the [open issues](https://github.com/MathiasReker/php-chmod/issues) for a complete list of proposed\nfeatures (and known\nissues).\n\n### Contributing\n\nIf you have a suggestion to improve this, please fork the repo and create a pull request. You can also open an issue\nwith the tag \"enhancement\". Finally, don't forget to give the project a star! Thanks again!\n\n#### Docker\n\nIf you are using docker, you can use the following command to get started:\n\n```bash\ndocker-compose up -d\n```\n\nNext, access the container:\n\n```bash\ndocker exec -it php-chmod bash\n```\n\n#### Tools\n\nPHP Coding Standards Fixer:\n\n```bash\ncomposer run-script cs-fix\n```\n\nPHP Coding Standards Checker:\n\n```bash\ncomposer run-script cs-check\n```\n\nPHP Stan:\n\n```bash\ncomposer run-script phpstan\n```\n\nUnit tests:\n\n```bash\ncomposer run-script test\n```\n\n### License\n\nIt is distributed under the MIT License. See `LICENSE` for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathiasreker%2Fphp-chmod","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathiasreker%2Fphp-chmod","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathiasreker%2Fphp-chmod/lists"}