/
laraveltest.php
143 lines (116 loc) · 3.87 KB
/
laraveltest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
/*
* Laravel Requirements Checklist
*
* Verifies Laravel requirements
*
* For version 5.8:
* PHP >= 7.1.3
* BCMath PHP Extension
* Ctype PHP Extension
* JSON PHP Extension
* Mbstring PHP Extension
* OpenSSL PHP Extension
* PDO PHP Extension
* Tokenizer PHP Extension
* XML PHP Extension
*
* optional:
* PDO_SQLite (if you plan to use SQLite)
*
* Author: Andrea Bergamasco <abergamasco@gmail.com>
*/
define('LARAVEL_MIN_PHP_VERSION', '7.1.3');
$required_extensions = [
'bcmath' => 'BCMath',
'ctype' => 'Ctype',
'json' => 'JSON',
'mbstring' => 'Mbstring',
'openssl' => 'OpenSSL',
'pdo' => 'PDO',
'tokenizer' => 'Tokenizer',
'xml' => 'XML',
];
$optional_extensions = [
'pdo_sqlite' => 'PDO_SQLite',
];
?><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Laravel Requirements Checklist</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<div class="container">
<div class="row">
<h1>Laravel Requirements Checklist</h1>
</div>
<!-- PHP >= 7.1.3 -->
<div class="row">
<h3>PHP version</h3>
<?php if (version_compare(PHP_VERSION, LARAVEL_MIN_PHP_VERSION) >= 0) { ?>
<div class="alert alert-success" role="alert">
The minimum PHP version supported is <?php echo LARAVEL_MIN_PHP_VERSION; ?>,
this server is running version <?php echo PHP_VERSION; ?>
</div>
<?php } else { ?>
<div class="alert alert-danger" role="alert">
The minimum PHP version supported is <?php echo LARAVEL_MIN_PHP_VERSION ?>',
this server is running version <?php echo PHP_VERSION; ?>
</div>
<?php } ?>
</div>
<?php foreach($required_extensions as $ext_slug => $ext_name): ?>
<!-- <?= $ext_name ?> PHP Extension -->
<div class="row">
<h3><?= $ext_name ?> PHP Extension</h3>
<?php
$ext_version = null;
try {
$ext = new ReflectionExtension($ext_slug);
$ext_version = $ext->getVersion();
} catch(ReflectionException $exception) {
$ext_version = null;
}
if ($ext_version): ?>
<div class="alert alert-success" role="alert">
<?= $ext_name ?> PHP extension available in version <?php echo $ext_version; ?>
</div>
<?php else: ?>
<div class="alert alert-danger" role="alert">
<?= $ext_name ?> PHP extension not available.
<pre style="margin-top: 10px;"><?= $exception->getMessage() ?></pre>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
<div class="row">
<h2>Optional extensions</h2>
</div>
<?php foreach($optional_extensions as $ext => $ext_name): ?>
<div class="row">
<h3><?= $ext_name ?> PHP Extension</h3>
<?php
$ext_version = null;
try {
$ext = new ReflectionExtension($ext_slug);
$ext_version = $ext->getVersion();
} catch(ReflectionException $exception) {
$ext_version = null;
}
if ($ext_version): ?>
<div class="alert alert-success" role="alert">
<?= $ext_name ?> PHP extension available in version <?php echo $ext_version; ?>
</div>
<?php else: ?>
<div class="alert alert-danger" role="alert">
<?= $ext_name ?> PHP extension not available.
<pre style="margin-top: 10px;"><?= $exception->getMessage() ?></pre>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
</body>
</html>