{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/8306","labels_url":"https://api.github.com/repos/laravel/framework/issues/8306/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/8306/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/8306/events","html_url":"https://github.com/laravel/framework/issues/8306","id":66851603,"number":8306,"title":"[5.1][Console][Request] Style Guide helpers","user":{"login":"barryvdh","id":973269,"avatar_url":"https://avatars.githubusercontent.com/u/973269?v=3","gravatar_id":"","url":"https://api.github.com/users/barryvdh","html_url":"https://github.com/barryvdh","followers_url":"https://api.github.com/users/barryvdh/followers","following_url":"https://api.github.com/users/barryvdh/following{/other_user}","gists_url":"https://api.github.com/users/barryvdh/gists{/gist_id}","starred_url":"https://api.github.com/users/barryvdh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barryvdh/subscriptions","organizations_url":"https://api.github.com/users/barryvdh/orgs","repos_url":"https://api.github.com/users/barryvdh/repos","events_url":"https://api.github.com/users/barryvdh/events{/privacy}","received_events_url":"https://api.github.com/users/barryvdh/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-07T10:43:13Z","updated_at":"2015-04-08T11:07:25Z","closed_at":"2015-04-08T11:07:25Z","body":"In Symfony 2.7, Style Guide helpers are added (see https://github.com/symfony/symfony/pull/14057 and https://github.com/symfony/symfony/commit/96b4210de5386c88b279cfc62088ef54e461c701 )\r\n\r\nThis adds a [StyleInterface](https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Console/Style/StyleInterface.php) with a few common helpers, similar to the helpers that Laravel currently adds.\r\n\r\nPerhaps it would be a good idea to make a Laravel Style, that perhaps extends the Symfony one. The existing helper functions could be redirected to the Style ouput, new methods can also be directed to the style helper or be available as $style for example.\r\n\r\nThe OutputStyle also implements the OutputInterface, so the Output could be changed to the OutputStyle.\r\n\r\nPros:\r\n - Easier to use\r\n - Prettier ouput\r\n - Uniformity between commands\r\n - Leverage Symfony helpers/code\r\n - Interoperability with Symfony\r\n\r\nCons:\r\n - Some helpers have different signatures, so might give confusion.\r\n\r\nExample:\r\n```php\r\n    public function run(InputInterface $input, OutputInterface $output)\r\n\t{\r\n\t\t$this->input = $input;\r\n\t\t$this->output = new LaravelStyle($output);\r\n\t\treturn parent::run($input, $output);\r\n\t}\r\n        \r\n    public function ask($question, $default = null)\r\n    {\r\n        return $this->output ->ask($question, $default);\r\n    }\r\n```\r\n\r\nTable with current/symfony helpers:\r\n\r\n|Symfony StyleInterface|Laravel Command|\r\n|----------------------|-------------------|\r\n|title($message)|n/a\r\n|section($message)|n/a\r\n|listing(array $elements)|n/a\r\n|text($message)|line($string)\r\n|success($message)|n/a\r\n|error($message)|error($string)\r\n|warning($message)|n/a\r\n|note($message)|info($string)\r\n|caution($message)|n/a\r\n|n/a|comment($string)\r\n|n/a|question($string)\r\n|table(array $headers, array $rows)|table(array $headers, array $rows, $style = 'default')\r\n|ask($question, $default = null, $validator = null)|ask($question, $default = null)\r\n|askHidden($question, $validator = null)|secret($question, $fallback = true)\r\n|n/a|askWithCompletion($question, array $choices, $default = null)\r\n|confirm($question, $default = true)|confirm($question, $default = false)\r\n|choice($question, array $choices, $default = null)|choice($question, array $choices, $default = null, $attempts = null, $multiple = null)\r\n|newLine($count = 1)|n/a\r\n|progressStart($max = 0)|n/a\r\n|progressAdvance($step = 1)|n/a\r\n|progressFinish()|n/a\r\n\r\nAs this is for 5.1 (because only in Symfony 2.7), we could change the signatures perhaps, if it's worth the BC break. Otherwise keep the existing method signatures and make the style available for new helpers.\r\n\r\nI could make a PR for this if wanted."},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/90881496","html_url":"https://github.com/laravel/framework/issues/8306#issuecomment-90881496","issue_url":"https://api.github.com/repos/laravel/framework/issues/8306","id":90881496,"user":{"login":"barryvdh","id":973269,"avatar_url":"https://avatars.githubusercontent.com/u/973269?v=3","gravatar_id":"","url":"https://api.github.com/users/barryvdh","html_url":"https://github.com/barryvdh","followers_url":"https://api.github.com/users/barryvdh/followers","following_url":"https://api.github.com/users/barryvdh/following{/other_user}","gists_url":"https://api.github.com/users/barryvdh/gists{/gist_id}","starred_url":"https://api.github.com/users/barryvdh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barryvdh/subscriptions","organizations_url":"https://api.github.com/users/barryvdh/orgs","repos_url":"https://api.github.com/users/barryvdh/repos","events_url":"https://api.github.com/users/barryvdh/events{/privacy}","received_events_url":"https://api.github.com/users/barryvdh/received_events","type":"User","site_admin":false},"created_at":"2015-04-08T11:07:25Z","updated_at":"2015-04-08T11:07:25Z","body":"Replaced by #8338"}}