Root directory
contents | Secondary directory | Introduction | effect |
---|---|---|---|
/app | Application Directory | The core code of the application | |
/bootstrap | Startup directory | ||
app.php | Frame startup and auto-loading configuration | ||
./cache | Routing and service caching | Files generated by the framework to improve performance | |
/config | Configuration directory | ||
/database | database directory | Database migration files and filling files | |
/public | Public Directory | Application entry files and front-end resource files | |
index.php | Application entry file | ||
/resources | Resource catalog | Application view files and uncompiled native front-end resource files | |
/routes | routing directory | ||
web.php | web middleware group | Support Session, CSRF protection and Cookie encryption function | |
api.php | api middleware group | Support frequency limit function | |
console.php | Console command | Used to define all closure-based console commands | |
channels.php | Used to register all event broadcast channels supported by the application | ||
/storage | File storage directory | Blade, Session, file cache, files generated by the framework | |
./app | Application-generated files | ||
./public | Used to store user-generated files | ||
./framework | Files and caches generated by the framework | ||
./logs | Application log file | ||
/tests | test catalog | You can run the test phpunit | |
/vendor | dependent directory | Contains all dependencies of Composer |
Remark
1. Console routing/routes/console.php
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');
php artisan inspire
Application directory/app
contents | Introduction | effect |
---|---|---|
/Broadcasting | Broadcast channel | Event broadcast. make:channel |
/Console | Task script | Register Artisan commands to define scheduling tasks. make:command |
/Events | event | Store the event class. event:generate and make:event |
/Exceptions | Exception handling | Contains application exception handler |
/Http | Web application | Contains controllers, middleware, and form requests, etc. |
/Jobs | Queue task | Store queue tasks. make:job |
/Listeners | Event monitoring | Event listener. event:generate and make:listener |
Mail related classes. make:mail | ||
/Models | Eloquent model | Eloquent model class. make:model |
/Notifications | notify | Send notification. make:notification |
/Policies | Authorization | Authorization strategy. make:policy |
/Providers | service provider | Bind services to containers, register events, and perform other tasks during application startup. |
/Rules | Validation rules | Encapsulate complex verification logic in a single object. make:rule |
Remark
PSR-4 automatic loading standard https://learnku.com/docs/psr/psr-4-autoloader/1608
1. "Class" here refers to all classes, interfaces, traits, reusable code blocks, and other similar structures.
2. A complete class name must have the following structure:
\<命名空间>(\<子命名空间>)*\<类名>
- The complete class name must have a top-level namespace, called "vendor namespace";
- The complete class name can have one or more sub-namespaces;
- The complete class name must have a final class name;
- The underline in any part of the complete class name has no special meaning;
- The complete class name can consist of any uppercase and lowercase letters;
- All class names must be case sensitive.
- When loading the corresponding file according to the complete class name...
- In the complete class name, the first namespace separator is removed, and one or more consecutive namespaces and sub-namespaces in front are used as "namespace prefixes", which must correspond to at least one "root directory";
- immediately after the namespace prefix must with the corresponding "file base directory", and the namespace separator will be used as the directory separator
- The class name at the end must be the same as the corresponding file with the suffix .php.
- The implementation of the autoloader must not throw exceptions, must not trigger any level of error message, and should not have a return value.
3. Examples
| Full class name | Namespace prefix | File base directory | File path |
| :--------------------------- | :-------------- | :--------------------- | :---------------------------------------- |
| \Acme\Log\Writer\File_Writer | Acme\Log\Writer | ./acme-log-writer/lib/ | ./acme-log-writer/lib/File_Writer.php |
| \Aura\Web\Response\Status | Aura\Web | /path/to/aura-web/src/ | /path/to/aura-web/src/Response/Status.php |
| \Symfony\Core\Request | Symfony\Core | ./vendor/Symfony/Core/ | ./vendor/Symfony/Core/Request.php |
| \Zend\Acl | Zend | /usr/includes/Zend/ | /usr/includes/Zend/Acl.php |
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。