Skip to content

Commit 74e9ea4

Browse files
committed
2022 update: PHP8.1, Ubuntu 22.04, nginx, easier setup
1 parent 75c0a61 commit 74e9ea4

File tree

12 files changed

+161
-102
lines changed

12 files changed

+161
-102
lines changed

.htaccess

Lines changed: 0 additions & 4 deletions
This file was deleted.

README.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
# MINI3
44

55
MINI3 is an extremely simple and easy to understand skeleton PHP application, reduced to the max.
6-
MINI3 is NOT a professional framework and it does not come with all the stuff real frameworks have.
6+
MINI3 is NOT a professional framework and does not come with all the stuff real frameworks have.
77
If you just want to show some pages, do a few database calls and a little-bit of AJAX here and there, without
88
reading in massive documentations of highly complex professional frameworks, then MINI3 might be very useful for you.
99
MINI3 is easy to install, runs nearly everywhere and doesn't make things more complicated than necessary.
1010

11+
1112
[MINI](https://github.com/panique/mini) (original version) and [MINI2](https://github.com/panique/mini2) (used Slim router) were built by me (panique), MINI3 is an excellent and improved version
1213
of the original MINI, made by [JaoNoctus](https://github.com/JaoNoctus). Big thanks, man! :)
1314

@@ -24,12 +25,33 @@ of the original MINI, made by [JaoNoctus](https://github.com/JaoNoctus). Big tha
2425
- uses only native PHP code, so people don't have to learn a framework
2526
- uses PSR-4 autoloader
2627

27-
## Requirements
28+
## Requirements (but it's auto-installed)
2829

29-
- PHP 5.6 or PHP 7.0
30+
- PHP 8
3031
- MySQL
31-
- mod_rewrite activated (see below for tutorials)
3232
- basic knowledge of Composer for sure
33+
- for auto-installation: VirtualBox, Vagrant
34+
35+
## Installation (in Vagrant, 100% automatic)
36+
37+
To keep things super-simple, we are using Vagrant here, a simple technology to run virtual machines for development.
38+
It's outdated, but does the job, and is much easier to understand than Docker. Just install VirtualBox, Vagrant, then
39+
copy this repo's code to a folder, go to that folder and type:
40+
41+
```bash
42+
vagrant up
43+
```
44+
45+
This will create a virtual machine with the configs given in `Vagrantfile`: It will create an Ubuntu 2022.04 Jammy64
46+
VM with 1024MB RAM, sync the current folder to `/var/www/html` inside the VM, make the VM available on the IP
47+
`192.168.56.77` and start the bash script `bootstrap.sh`, which is just a set of commands that will install all
48+
necessary software.
49+
50+
If the auto-installer is finished, go to http://192.168.56.77 in your browser and click around a bit ;)
51+
52+
# OLD INSTALLATION TUTORIALS FROM 2016
53+
54+
Below you'll find installation tutorial for the old version of MINI3 from 2016.
3355

3456
## Installation (in Vagrant, 100% automatic)
3557

_vagrant/Vagrantfile renamed to Vagrantfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@ VAGRANTFILE_API_VERSION = "2"
66

77
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
88

9-
# Every Vagrant virtual environment requires a box to build off of.
10-
config.vm.box = "ubuntu/trusty64"
9+
# Ubuntu 2022.04
10+
config.vm.box = "ubuntu/jammy64"
1111

1212
# Create a private network, which allows host-only access to the machine using a specific IP.
13-
config.vm.network "private_network", ip: "192.168.33.66"
13+
config.vm.network "private_network", ip: "192.168.56.77"
14+
15+
config.vm.provider "virtualbox" do |vb|
16+
vb.memory = "1024"
17+
end
1418

1519
# Share an additional folder to the guest VM. The first argument is the path on the host to the actual folder.
1620
# The second argument is the path on the guest to mount the folder.

_install/mini3.png

-58.5 KB
Binary file not shown.

_install/nginx/default

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
server {
2+
listen 80 default_server;
3+
listen [::]:80 default_server;
4+
5+
root /var/www/html/public;
6+
7+
index index.html index.htm index.nginx-debian.html;
8+
9+
server_name _;
10+
11+
# location / {
12+
# try_files $uri /index.php$is_args$args;
13+
# }
14+
15+
location / {
16+
index index.php;
17+
try_files /$uri /$uri/ /index.php?url=$uri;
18+
}
19+
20+
21+
# pass PHP scripts to FastCGI server
22+
#
23+
#location ~ \.php$ {
24+
# include snippets/fastcgi-php.conf;
25+
#
26+
# # With php-fpm (or other unix sockets):
27+
# fastcgi_pass unix:/run/php/php7.4-fpm.sock;
28+
# # With php-cgi (or other tcp sockets):
29+
# fastcgi_pass 127.0.0.1:9000;
30+
#}
31+
32+
location ~ \.php$ {
33+
include snippets/fastcgi-php.conf;
34+
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
35+
#fastcgi_index index.php;
36+
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
37+
#include fastcgi_params;
38+
}
39+
location ~ /\.ht {
40+
deny all;
41+
}
42+
43+
# deny access to .htaccess files, if Apache's document root
44+
# concurs with nginx's one
45+
#
46+
#location ~ /\.ht {
47+
# deny all;
48+
#}
49+
}
50+
51+
52+
# Virtual Host configuration for example.com
53+
#
54+
# You can move that to a different file under sites-available/ and symlink that
55+
# to sites-enabled/ to enable it.
56+
#
57+
#server {
58+
# listen 80;
59+
# listen [::]:80;
60+
#
61+
# server_name example.com;
62+
#
63+
# root /var/www/example.com;
64+
# index index.html;
65+
#
66+
# location / {
67+
# try_files $uri $uri/ =404;
68+
# }
69+
#}

_vagrant/bootstrap.sh

Lines changed: 0 additions & 76 deletions
This file was deleted.

application/Core/Application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct()
3737
$this->url_controller = new $controller();
3838

3939
// check for method: does such a method exist in the controller ?
40-
if (method_exists($this->url_controller, $this->url_action)) {
40+
if (method_exists($this->url_controller, (string) $this->url_action)) {
4141

4242
if (!empty($this->url_params)) {
4343
// Call the method and pass arguments to it
@@ -48,7 +48,7 @@ public function __construct()
4848
}
4949

5050
} else {
51-
if (strlen($this->url_action) == 0) {
51+
if (empty($this->url_action)) {
5252
// no action defined: call the default index() method of a selected controller
5353
$this->url_controller->index();
5454
} else {

0 commit comments

Comments
 (0)