Illuminate\Foundation\Application useNamespace() method? #37833
-
Whenever I start a new application, I like to move my // src/App/Application.php
namespace App;
class Application extends \Illuminate\Foundation\Application
{
protected $namespace = 'App\\';
} And then use that in my $app = (new App\Application(
realpath(__DIR__.'/../')
))
->useAppPath(__DIR__ . '/../src/App'); I'm sure there's all kinds of advanced things you can do by extending Application, but it seems a bit overkill just for changing the namespace. I would love to have a $app = (new \Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
))
->useAppPath(__DIR__ . '/../src/App')
->useNamespace('App\\'); I'd be happy to open a PR if I'm not the only one, but thought I'd open a discussion first. Definitely a small thing, but it would make starting a new project that much cleaner :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
In Laravel Beyond CRUD, it hsa this paragraph:
But I don't see where this happens (please point that out if I've missed it!). What I do see though is this: framework/src/Illuminate/Foundation/Application.php Lines 1383 to 1400 in 6db59af It appears the namespace will be grabbed from I had a quick look back at the history of |
Beta Was this translation helpful? Give feedback.
In Laravel Beyond CRUD, it hsa this paragraph:
But I don't see where this happens (please point that out if I've missed it!). What I do see though is this:
framework/src/Illuminate/Foundation/Application.php
Lines 1383 to 1400 in 6db59af