1
|
|
|
<?php |
|
|
|
|
2
|
|
|
|
3
|
|
|
define('LARAVEL_START', microtime(true)); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
|-------------------------------------------------------------------------- |
7
|
|
|
| Register The Composer Auto Loader |
8
|
|
|
|-------------------------------------------------------------------------- |
9
|
|
|
| |
10
|
|
|
| Composer provides a convenient, automatically generated class loader |
11
|
|
|
| for our application. We just need to utilize it! We'll require it |
12
|
|
|
| into the script here so that we do not have to worry about the |
13
|
|
|
| loading of any our classes "manually". Feels great to relax. |
14
|
|
|
| |
15
|
|
|
*/ |
16
|
|
|
|
17
|
|
|
require __DIR__.'/../vendor/autoload.php'; |
18
|
|
|
|
19
|
|
|
/* |
20
|
|
|
|-------------------------------------------------------------------------- |
21
|
|
|
| Include The Compiled Class File |
22
|
|
|
|-------------------------------------------------------------------------- |
23
|
|
|
| |
24
|
|
|
| To dramatically increase your application's performance, you may use a |
25
|
|
|
| compiled class file which contains all of the classes commonly used |
26
|
|
|
| by a request. The Artisan "optimize" is used to create this file. |
27
|
|
|
| |
28
|
|
|
*/ |
29
|
|
|
|
30
|
|
|
if (file_exists($compiled = __DIR__.'/compiled.php')) |
31
|
|
|
{ |
32
|
|
|
require $compiled; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/* |
36
|
|
|
|-------------------------------------------------------------------------- |
37
|
|
|
| Setup Patchwork UTF-8 Handling |
38
|
|
|
|-------------------------------------------------------------------------- |
39
|
|
|
| |
40
|
|
|
| The Patchwork library provides solid handling of UTF-8 strings as well |
41
|
|
|
| as provides replacements for all mb_* and iconv type functions that |
42
|
|
|
| are not available by default in PHP. We'll setup this stuff here. |
43
|
|
|
| |
44
|
|
|
*/ |
45
|
|
|
|
46
|
|
|
Patchwork\Utf8\Bootup::initMbstring(); |
47
|
|
|
|
48
|
|
|
/* |
49
|
|
|
|-------------------------------------------------------------------------- |
50
|
|
|
| Register The Laravel Auto Loader |
51
|
|
|
|-------------------------------------------------------------------------- |
52
|
|
|
| |
53
|
|
|
| We register an auto-loader "behind" the Composer loader that can load |
54
|
|
|
| model classes on the fly, even if the autoload files have not been |
55
|
|
|
| regenerated for the application. We'll add it to the stack here. |
56
|
|
|
| |
57
|
|
|
*/ |
58
|
|
|
|
59
|
|
|
Illuminate\Support\ClassLoader::register(); |
60
|
|
|
|
61
|
|
|
/* |
62
|
|
|
|-------------------------------------------------------------------------- |
63
|
|
|
| Register The Workbench Loaders |
64
|
|
|
|-------------------------------------------------------------------------- |
65
|
|
|
| |
66
|
|
|
| The Laravel workbench provides a convenient place to develop packages |
67
|
|
|
| when working locally. However we will need to load in the Composer |
68
|
|
|
| auto-load files for the packages so that these can be used here. |
69
|
|
|
| |
70
|
|
|
*/ |
71
|
|
|
|
72
|
|
|
if (is_dir($workbench = __DIR__.'/../workbench')) |
73
|
|
|
{ |
74
|
|
|
Illuminate\Workbench\Starter::start($workbench); |
75
|
|
|
} |
76
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.