{"id":13493108,"url":"https://github.com/adael/SublimePhpCsFixer","last_synced_at":"2025-03-28T11:31:43.142Z","repository":{"id":48309814,"uuid":"93063879","full_name":"adael/SublimePhpCsFixer","owner":"adael","description":"Run php-cs-fixer code formatter to format php code from your favorite text editor","archived":false,"fork":false,"pushed_at":"2023-02-07T09:37:53.000Z","size":53,"stargazers_count":71,"open_issues_count":2,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-31T07:34:13.078Z","etag":null,"topics":["code-formatter","php","sublime-text"],"latest_commit_sha":null,"homepage":"","language":"Python","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/adael.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-06-01T14:06:10.000Z","updated_at":"2024-09-27T02:29:14.000Z","dependencies_parsed_at":"2023-02-19T16:16:13.198Z","dependency_job_id":null,"html_url":"https://github.com/adael/SublimePhpCsFixer","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adael%2FSublimePhpCsFixer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adael%2FSublimePhpCsFixer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adael%2FSublimePhpCsFixer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adael%2FSublimePhpCsFixer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adael","download_url":"https://codeload.github.com/adael/SublimePhpCsFixer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246020992,"owners_count":20710864,"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":["code-formatter","php","sublime-text"],"created_at":"2024-07-31T19:01:12.308Z","updated_at":"2025-03-28T11:31:42.923Z","avatar_url":"https://github.com/adael.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Sublime PHP CS Fixer\nThis is a plugin for Sublime Text 3/4, to format PHP code through php-cs-fixer command on any view.\n\n# Features\n\n* It works inside a temporal view (ie: on an new, non-saved file)\n* Fast\n* Easy\n* Configurable through rules or a config file\n* Tested on Windows and Linux\n\n# Configuration\n\nYou have to install the actual php-cs-fixer (the actual tool made by sensiolabs, not this plugin)\n\nYou can install php-cs-fixer directly with composer by running:\n\n    composer global require friendsofphp/php-cs-fixer\n\nAlso you can create a config file as explained here https://github.com/FriendsOfPHP/PHP-CS-Fixer\n\n*for example in:* `$HOME/.php-cs-fixer.php`\n\n```php\n\u003c?php\n\nreturn (new PhpCsFixer\\Config)\n    -\u003esetRules([\n        '@Symfony' =\u003e true,\n        'array_syntax' =\u003e ['syntax' =\u003e 'short'],\n    ]);\n```\n\nIf you've created a config file, you have to configure its path in the plugin's settings.\n\n*In Menu -\u003e Preferences -\u003e Package Settings -\u003e PHP CS Fixer -\u003e Settings - user*\n\n```js\n{\n    \"config\": \"/path/to/.php-cs-fixer.php\"\n}\n```\n\nWhen using multiple projects with different configurations, it's possible to\nconfigure the path relative to the Sublime project folder:\n\n```js\n{\n    \"config\": \"${folder}/.php-cs-fixer.php\",\n    \"php\": \"${packages}/User/php\",\n    \"path\": \"${packages}/User/php-cs-fixer.php\"\n}\n```\n\nIt's also possible to specify multiple config paths. In that case, the first readable file is used:\n\n```js\n{\n    \"config\": [\n        \"${file_path}/.php-cs-fixer.php\",\n        \"${folder}/.php-cs-fixer.php\",\n        \"/path/to/.php-cs-fixer.php\"\n    ]\n}\n```\n\nSee [`extract_variables` in the Sublime API Reference](https://www.sublimetext.com/docs/3/api_reference.html#sublime.Window)\nfor the supported replacement variables. The value of the `${folder}` points\nthe path of the first project in Sublime API. Here, it's beforehand replaced\nwith the path of the project the target file belongs.\n\nPlease note:\n\n* **`rules` and `config` directives are excluding.**\n* This plugin don't try to find the config file automatically. If you want to\ncreate a config file, you have to specify its path in the plugin settings.\n\n## Rules\n\n```js\n{\n    \"rules\": {\n        \"@PhpCsFixer\": true,\n    },\n    // or\n    \"rules\": \"@PhpCsFixer\",\n    // or\n    \"rules\": [\n        \"@PhpCsFixer\"\n    ]\n}\n```\n\n*Please note that `rules` and `config` directives are excluding.*\n\nFor more information see: https://github.com/FriendsOfPHP/PHP-CS-Fixer#usage\n\n## Exclude files\n\nSince all php files are passed directly to the php-cs-fixer executable, a configured PhpCsFixer\\\\Finder gets ignored.\nIn order to exclude files from php-cs-fixer, you can use the \"exclude\" setting:\n\n```js\n{\n    \"exclude\": [\n        \".*[\\\\\\\\/]vendor[\\\\\\\\/].*\", // vendor-path (used by Composer)\n        \".*\\\\.phtml$\" // files ending with \".phtml\"\n    ]\n}\n```\n\nThe exclude-filter uses python regular expressions.\nFor more information see: https://docs.python.org/2/library/re.html\n\n\n### On Windows:\n\nThe plugin tries to find the executable in:\n\n    %APPDATA%\\composer\\vendor\\bin\\php-cs-fixer.bat\n\nIf it isn't working, you can locate your composer global packages path by running:\n\n    composer config -g home\n\n### On Linux:\n\nAfter installing php-cs-fixer you have to specify the full path to the\nexecutable in the configuration page.\n\nThe plugin tries to find the executable in:\n\n    $HOME/.composer/vendor/bin/php-cs-fixer\n\nHowever, if it isn't working, you can create a symbolic link to the php-cs-fixer executable\n\n    ln -s $HOME/.composer/vendor/bin/php-cs-fixer $HOME/bin/php-cs-fixer\n\n### Note\n\nI've checked this on Linux and Windows, but I cannot check it on OSX.\nI'll thank you if someone tells me if it's working on OSX and give me\nsome details on how to configure it.\n\n# Acknowledgements\n\nI would like to thank to sensiolabs and contributors for their awesome package.\nIt works flawlessly. All the work here belongs to them.\n\nCheck them at:\n\n* https://github.com/FriendsOfPHP/PHP-CS-Fixer\n* http://cs.sensiolabs.org/\n\nI'd also learned some of the sublime package structure from:\n\n* https://github.com/Ennosuke/PHP-Codebeautifier\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadael%2FSublimePhpCsFixer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadael%2FSublimePhpCsFixer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadael%2FSublimePhpCsFixer/lists"}