{"action":"created","issue":{"url":"https://api.github.com/repos/pyrocms/pyrocms/issues/3810","repository_url":"https://api.github.com/repos/pyrocms/pyrocms","labels_url":"https://api.github.com/repos/pyrocms/pyrocms/issues/3810/labels{/name}","comments_url":"https://api.github.com/repos/pyrocms/pyrocms/issues/3810/comments","events_url":"https://api.github.com/repos/pyrocms/pyrocms/issues/3810/events","html_url":"https://github.com/pyrocms/pyrocms/issues/3810","id":170834866,"number":3810,"title":"Using artisan's app:name task give errors (PSR-4)","user":{"login":"PMK","id":355176,"avatar_url":"https://avatars.githubusercontent.com/u/355176?v=3","gravatar_id":"","url":"https://api.github.com/users/PMK","html_url":"https://github.com/PMK","followers_url":"https://api.github.com/users/PMK/followers","following_url":"https://api.github.com/users/PMK/following{/other_user}","gists_url":"https://api.github.com/users/PMK/gists{/gist_id}","starred_url":"https://api.github.com/users/PMK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PMK/subscriptions","organizations_url":"https://api.github.com/users/PMK/orgs","repos_url":"https://api.github.com/users/PMK/repos","events_url":"https://api.github.com/users/PMK/events{/privacy}","received_events_url":"https://api.github.com/users/PMK/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-12T09:40:08Z","updated_at":"2016-08-15T13:57:47Z","closed_at":null,"body":"I create a new project with PyroCMS. Then I use the Artisan command to change my project's App name. Laravel supports PSR-4, but this action triggers some errors. At the end I would like to implement the CMS on an existing Laravel 5.1 LTS site, with using an App name.\r\n\r\n```\r\n$ composer create-project pyrocms/pyrocms\r\n[...] Everything went well, no errors\r\n\r\n$ php artisan app:name Testname\r\nPHP Fatal error:  Class 'App\\Exceptions\\Handler' not found in pyrocms/vendor/anomaly/streams-platform/src/Exception/ExceptionHandler.php on line 19\r\nPHP Fatal error:  Uncaught exception 'ReflectionException' with message 'Class Anomaly\\Streams\\Platform\\Exception\\ExceptionHandler does not exist' in pyrocms/bootstrap/cache/compiled.php:1291\r\nStack trace:\r\n#0 pyrocms/bootstrap/cache/compiled.php(1291): ReflectionClass->__construct('Anomaly\\\\Streams...')\r\n#1 pyrocms/bootstrap/cache/compiled.php(1242): Illuminate\\Container\\Container->build('Anomaly\\\\Streams...', Array)\r\n#2 pyrocms/bootstrap/cache/compiled.php(1783): Illuminate\\Container\\Container->make('Anomaly\\\\Streams...', Array)\r\n#3 pyrocms/bootstrap/cache/compiled.php(1065): Illuminate\\Foundation\\Application->make('Anomaly\\\\Streams...', Array)\r\n#4 pyrocms/bootstrap/cache/compiled.php(1289): Illuminate\\Container\\Container->Illuminate\\Container\\{closure}(Object(Illum in pyrocms/bootstrap/cache/compiled.php on line 1291\r\n```\r\n\r\nIn an existing Laravel 5.1 LTS site, using already an App name, the same is happening.\r\n\r\n```\r\nPHP Fatal error:  Class 'App\\Exceptions\\Handler' not found in /home/vagrant/l51/vendor/anomaly/streams-platform/src/Exception/ExceptionHandler.php on line 18\r\nPHP Stack trace:\r\nPHP   1. {main}() /home/vagrant/l51/artisan:0\r\nPHP   2. Illuminate\\Foundation\\Console\\Kernel->handle() /home/vagrant/l51/artisan:35\r\nPHP   3. Illuminate\\Foundation\\Console\\Kernel->reportException() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:109\r\nPHP   4. Illuminate\\Container\\Container->offsetGet() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:250\r\nPHP   5. Illuminate\\Foundation\\Application->make() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php:1167\r\nPHP   6. Illuminate\\Container\\Container->make() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:674\r\nPHP   7. Illuminate\\Container\\Container->build() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php:631\r\nPHP   8. Illuminate\\Container\\Container->Illuminate\\Container\\{closure}() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php:738\r\nPHP   9. Illuminate\\Foundation\\Application->make() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php:220\r\nPHP  10. Illuminate\\Container\\Container->make() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:674\r\nPHP  11. Illuminate\\Container\\Container->build() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php:631\r\nPHP  12. ReflectionClass->__construct() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php:741\r\nPHP  13. spl_autoload_call() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php:741\r\nPHP  14. Composer\\Autoload\\ClassLoader->loadClass() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php:741\r\nPHP  15. Composer\\Autoload\\includeFile() /home/vagrant/l51/vendor/composer/ClassLoader.php:301\r\nPHP  16. include() /home/vagrant/l51/vendor/composer/ClassLoader.php:412\r\nPHP Fatal error:  Uncaught ReflectionException: Class Anomaly\\Streams\\Platform\\Exception\\ExceptionHandler does not exist in /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php:741\r\nStack trace:\r\n#0 /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php(741): ReflectionClass->__construct('Anomaly\\\\Streams...')\r\n#1 /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\\Container\\Container->build('Anomaly\\\\Streams...', Array)\r\n#2 /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\\Container\\Container->make('Anomaly\\\\Streams...', Array)\r\n#3 /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php(220): Illuminate\\Foundation\\Application->make('Anomaly\\\\Streams...', Array)\r\n#4 /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php(738): Illuminate\\Container\\Container->Illuminate\\Container\\{closure}(Object(Illuminate\\Foundation\\Application) in /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 741\r\nPHP Stack trace:\r\nPHP   1. {main}() /home/vagrant/l51/artisan:0\r\nPHP   2. Illuminate\\Foundation\\Console\\Kernel->handle() /home/vagrant/l51/artisan:35\r\nPHP   3. Illuminate\\Foundation\\Console\\Kernel->reportException() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:109\r\nPHP   4. Illuminate\\Container\\Container->offsetGet() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:250\r\nPHP   5. Illuminate\\Foundation\\Application->make() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php:1167\r\nPHP   6. Illuminate\\Container\\Container->make() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:674\r\nPHP   7. Illuminate\\Container\\Container->build() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php:631\r\nPHP   8. Illuminate\\Container\\Container->Illuminate\\Container\\{closure}() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php:738\r\nPHP   9. Illuminate\\Foundation\\Application->make() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php:220\r\nPHP  10. Illuminate\\Container\\Container->make() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:674\r\nPHP  11. Illuminate\\Container\\Container->build() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php:631\r\nPHP  12. ReflectionClass->__construct() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php:741\r\nPHP  13. spl_autoload_call() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php:741\r\nPHP  14. Composer\\Autoload\\ClassLoader->loadClass() /home/vagrant/l51/vendor/laravel/framework/src/Illuminate/Container/Container.php:741\r\nPHP  15. Composer\\Autoload\\includeFile() /home/vagrant/l51/vendor/composer/ClassLoader.php:301\r\nPHP  16. include() /home/vagrant/l51/vendor/composer/ClassLoader.php:412\r\n```\r\n\r\nI assume that \"App\" in `App\\Exceptions\\Handler` cannot be found since the name changed. I'm not sure how to fix this using PSR-4. Maybe PyroCMS needs to use `app_path()`?\r\n\r\nThank you in advance."},"comment":{"url":"https://api.github.com/repos/pyrocms/pyrocms/issues/comments/239808265","html_url":"https://github.com/pyrocms/pyrocms/issues/3810#issuecomment-239808265","issue_url":"https://api.github.com/repos/pyrocms/pyrocms/issues/3810","id":239808265,"user":{"login":"RyanThompson","id":1099967,"avatar_url":"https://avatars.githubusercontent.com/u/1099967?v=3","gravatar_id":"","url":"https://api.github.com/users/RyanThompson","html_url":"https://github.com/RyanThompson","followers_url":"https://api.github.com/users/RyanThompson/followers","following_url":"https://api.github.com/users/RyanThompson/following{/other_user}","gists_url":"https://api.github.com/users/RyanThompson/gists{/gist_id}","starred_url":"https://api.github.com/users/RyanThompson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RyanThompson/subscriptions","organizations_url":"https://api.github.com/users/RyanThompson/orgs","repos_url":"https://api.github.com/users/RyanThompson/repos","events_url":"https://api.github.com/users/RyanThompson/events{/privacy}","received_events_url":"https://api.github.com/users/RyanThompson/received_events","type":"User","site_admin":false},"created_at":"2016-08-15T13:57:47Z","updated_at":"2016-08-15T13:57:47Z","body":"Aha, I understand now.. \r\n\r\nI am not entirely sure about this one. Because, like you say, I do auto load classes from the app namespace in order to override them.\r\n\r\nMy initial thought it is to copy the classes (or whats needed) or even extend the app's child class instead (skip the app version). And where that doesn't work or isn't enough then we can bind to the App class but with the appropriate namespace (in the StreamsServiceProvider).\r\n\r\nThis is an important bug you've discovered here! Would you be open to doing some of the leg work here to get things started off in the right direction? I would be more than happy to help guide you and finish it up with ya."}}
{"actor":{"display_login":"RyanThompson"}}