{"id":28795516,"url":"https://github.com/mohamed-samir907/php-aligner","last_synced_at":"2026-05-18T10:39:43.805Z","repository":{"id":299694944,"uuid":"1003896216","full_name":"mohamed-samir907/php-aligner","owner":"mohamed-samir907","description":"PHP Code Aligner","archived":false,"fork":false,"pushed_at":"2025-06-17T20:21:00.000Z","size":1068,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-03T18:48:03.641Z","etag":null,"topics":["align","aligner","alignment","array","formatter","linter","php","php7","php8"],"latest_commit_sha":null,"homepage":"https://marketplace.visualstudio.com/items?itemName=mohamed-samir907.php-aligner","language":"TypeScript","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/mohamed-samir907.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-17T19:59:56.000Z","updated_at":"2025-08-28T23:10:03.000Z","dependencies_parsed_at":"2025-06-17T21:38:05.988Z","dependency_job_id":null,"html_url":"https://github.com/mohamed-samir907/php-aligner","commit_stats":null,"previous_names":["mohamed-samir907/php-aligner"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mohamed-samir907/php-aligner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohamed-samir907%2Fphp-aligner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohamed-samir907%2Fphp-aligner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohamed-samir907%2Fphp-aligner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohamed-samir907%2Fphp-aligner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mohamed-samir907","download_url":"https://codeload.github.com/mohamed-samir907/php-aligner/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohamed-samir907%2Fphp-aligner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33175285,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T09:27:30.708Z","status":"ssl_error","status_checked_at":"2026-05-18T09:27:28.300Z","response_time":71,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["align","aligner","alignment","array","formatter","linter","php","php7","php8"],"created_at":"2025-06-18T03:09:11.722Z","updated_at":"2026-05-18T10:39:41.932Z","avatar_url":"https://github.com/mohamed-samir907.png","language":"TypeScript","funding_links":["https://github.com/sponsors/mohamed-samir907"],"categories":[],"sub_categories":[],"readme":"# PHP Aligner\n\n**PHP Aligner** is a Visual Studio Code extension that helps you automatically align your PHP code by organizing assignments and array structures based on `=` and `=\u003e` operators for better readability and consistent formatting.\n\n---\n\n## ✨ Features\n\n- ✅ Align `=` assignments (e.g., properties, constants, function parameters).\n- ✅ Align `=\u003e` in associative arrays (even nested arrays).\n- ✅ Supports auto-align on file save (configurable).\n- ✅ Skips alignment when `=\u003e` is immediately followed by an opening bracket `[` (e.g., nested arrays).\n- ✅ Works for entire files — no need to select text.\n- ✅ Command palette + keyboard shortcut support.\n\n---\n\n## 📸 Example\n\n### Before\n\n```php\n\u003c?php\n\nclass User {\n    private string $name = \"mohamed\";\n    private int $age = 25;\n\n    public function __construct(\n        private string $email = \"\",\n        private string $phoneNumber = \"\",\n    ) {\n    }\n    \n    public function process(\n        string $name = \"\",\n        string $email = \"\",\n        string $phoneNumber = \"\",\n        int $age = 0,\n    ): void {\n        $name1 = \"1\";\n        $phone23 = \"dsdS\";\n\n        $name234 = \"2\";\n        $phone234 = \"dsdS\";\n    }\n}\n\nconst PI = 3.14;\nconst NAME = \"mohamed\";\n\n$array = [\n    \"name\" =\u003e \"mohamed\",\n    \"age\" =\u003e 25,\n\n    \"data\"                  =\u003e [\n        \"email\" =\u003e \"test@example.com\",\n        \"phone-number\" =\u003e \"1234567890\",\n\n        \"address\"           =\u003e [\n            \"city\" =\u003e \"Cairo\",\n            \"country\" =\u003e \"Egypt\"\n        ],\n    ]\n];\n\nenum Status: int {\n    case Active = 1;\n    case Inactive = 0;\n}\n```\n\n### After (aligned)\n\n```php\nclass User {\n    private string $name = \"mohamed\";\n    private int $age     = 25;\n\n    public function __construct(\n        private string $email       = \"\",\n        private string $phoneNumber = \"\",\n    ) {\n    }\n    \n    public function process(\n        string $name        = \"\",\n        string $email       = \"\",\n        string $phoneNumber = \"\",\n        int $age            = 0,\n    ): void {\n        $name1   = \"1\";\n        $phone23 = \"dsdS\";\n\n        $name234  = \"2\";\n        $phone234 = \"dsdS\";\n    }\n}\n\nconst PI   = 3.14;\nconst NAME = \"mohamed\";\n\n$array = [\n    \"name\" =\u003e \"mohamed\",\n    \"age\"  =\u003e 25,\n\n    \"data\" =\u003e [\n        \"email\"        =\u003e \"test@example.com\",\n        \"phone-number\" =\u003e \"1234567890\",\n\n        \"address\" =\u003e [\n            \"city\"    =\u003e \"Cairo\",\n            \"country\" =\u003e \"Egypt\"\n        ],\n    ]\n];\n\nenum Status: int {\n    case Active   = 1;\n    case Inactive = 0;\n}\n```\n\n---\n\n## ⚙️ Extension Settings\n\n| Setting                       | Description                               | Default |\n| ----------------------------- | ----------------------------------------- | ------- |\n| `php-aligner.autoAlignOnSave` | Automatically align PHP code on file save | `true`  |\n\nYou can toggle this setting in **Settings → Extensions → PHP Aligner**.\n\n---\n\n## 🖱 Usage\n\n### Manual\n\n* Open a PHP file\n* Press `Ctrl + Alt + A` (or `⌘ + Option + A` on macOS)\n* Or run the command `Align PHP Code` from the Command Palette (`Ctrl + Shift + P`)\n\n### Automatic\n\n* By default, the extension will automatically align your PHP code when you save the file (you can disable this in settings).\n\n---\n\n## ⌨️ Keybinding\n\n* `Ctrl + Alt + A` (Windows/Linux)\n* `Cmd + Option + A` (macOS)\n\n---\n\n## 🛠 Requirements\n\n* VS Code `v1.101.0` or higher\n* PHP files (`.php`) only\n\n---\n\n## 🚀 Installation\n\nYou can install the extension via the [VS Code Marketplace](https://marketplace.visualstudio.com/) (after publishing) or manually by packaging and installing it:\n\n```bash\nnpm install -g vsce\nvsce package\n```\n\nThen drag the generated `.vsix` file into VS Code or run:\n\n```bash\ncode --install-extension php-aligner-0.0.1.vsix\n```\n\n---\n\n## ☕ Support the Developer\n\nIf you find this extension helpful, consider [sponsoring me on GitHub](https://github.com/sponsors/mohamed-samir907) to support further development! or starring the project ❤️\n\n---\n\n## 🧠 How It Works\n\n* Scans your file for sequences of lines with `=` or `=\u003e`.\n* Groups them and aligns the right-hand side values by padding the left-hand side consistently.\n* Automatically skips lines like:\n  `\"key\" =\u003e [` to avoid breaking nested structures.\n* Designed to not conflict with other formatters.\n\n---\n\n## 🧪 Contributing\n\nFeel free to open issues or submit PRs if you find bugs or want to improve the alignment rules.\n\n---\n\n## 📄 License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohamed-samir907%2Fphp-aligner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmohamed-samir907%2Fphp-aligner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohamed-samir907%2Fphp-aligner/lists"}