Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .htaccess

This file was deleted.

36 changes: 31 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
# MINI3

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


[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
of the original MINI, made by [JaoNoctus](https://github.com/JaoNoctus). Big thanks, man! :)

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

## Requirements
## Requirements (but it's auto-installed)

- PHP 5.6 or PHP 7.0
- PHP 8
- MySQL
- mod_rewrite activated (see below for tutorials)
- basic knowledge of Composer for sure
- for auto-installation: VirtualBox, Vagrant

## Forks

There are some nice upgraded versions of this mini framework, check it out at https://github.com/ribafs/php-router

## Installation (in Vagrant, 100% automatic)

To keep things super-simple, we are using Vagrant here, a simple technology to run virtual machines for development.
It's outdated, but does the job, and is much easier to understand than Docker. Just install VirtualBox, Vagrant, then
copy this repo's code to a folder, go to that folder and type:

```bash
vagrant up
```

This will create a virtual machine with the configs given in `Vagrantfile`: It will create an Ubuntu 2022.04 Jammy64
VM with 1024MB RAM, sync the current folder to `/var/www/html` inside the VM, make the VM available on the IP
`192.168.56.77` and start the bash script `bootstrap.sh`, which is just a set of commands that will install all
necessary software.

If the auto-installer is finished, go to http://192.168.56.77 in your browser and click around a bit ;)

# OLD INSTALLATION TUTORIALS FROM 2016

Below you'll find installation tutorial for the old version of MINI3 from 2016.

## Installation (in Vagrant, 100% automatic)

Expand Down Expand Up @@ -336,4 +362,4 @@ And by the way, I'm also blogging at [Dev Metal](http://www.dev-metal.com) :)

## Support the project

Rent your next server at [1&1](http://www.kqzyfj.com/click-8225476-12015878-1477926464000) to support this open source project.
<a href="https://www.buymeacoffee.com/panique" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
10 changes: 7 additions & 3 deletions _vagrant/Vagrantfile → Vagrantfile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

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

# Create a private network, which allows host-only access to the machine using a specific IP.
config.vm.network "private_network", ip: "192.168.33.66"
config.vm.network "private_network", ip: "192.168.56.77"

config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
end

# Share an additional folder to the guest VM. The first argument is the path on the host to the actual folder.
# The second argument is the path on the guest to mount the folder.
Expand Down
File renamed without changes.
24 changes: 24 additions & 0 deletions _install/nginx/default
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
server {
listen 80 default_server;
listen [::]:80 default_server;

root /var/www/html/public;

index index.html index.htm index.nginx-debian.html;

server_name _;

location / {
index index.php;
try_files /$uri /$uri/ /index.php?url=$uri;
}

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
}

location ~ /\.ht {
deny all;
}
}
76 changes: 0 additions & 76 deletions _vagrant/bootstrap.sh

This file was deleted.

4 changes: 2 additions & 2 deletions application/Core/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct()
$this->url_controller = new $controller();

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

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

} else {
if (strlen($this->url_action) == 0) {
if (empty($this->url_action)) {
// no action defined: call the default index() method of a selected controller
$this->url_controller->index();
} else {
Expand Down
57 changes: 0 additions & 57 deletions application/libs/helper.php

This file was deleted.

5 changes: 3 additions & 2 deletions application/view/_templates/footer.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@

<div class="footer">
Find <a href="https://github.com/panique/mini3">MINI3 on GitHub</a>.
If you like the project, support it by <a href="http://tracking.rackspace.com/SH1ES">using Rackspace</a> as your hoster [affiliate link].
<div style="margin-bottom: 20px">If you like the project, feel free to buy me a coffee by clicking the yellow button ;)</div>
<a href="https://www.buymeacoffee.com/panique" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
</div>

<!-- jQuery, loaded in the recommended protocol-less way -->
<!-- more http://www.paulirish.com/2010/the-protocol-relative-url/ -->
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="//code.jquery.com/jquery-3.6.1.min.js"></script>

<!-- define the project's URL (to make AJAX calls possible, even when using this in sub-folders etc) -->
<script>
Expand Down
57 changes: 57 additions & 0 deletions bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env bash

# Use single quotes instead of double quotes to make it work with special-character passwords.
# If you change it here, also change it in the config.php file!
PASSWORD='12345678'

# update / upgrade
sudo apt-get update
sudo apt-get -y upgrade

# php
sudo apt install -y php8.1-fpm
# php modules
sudo apt install -y php-xml
sudo apt install -y php-mbstring
sudo apt install -y php-zip

# nginx, copy nginx config into Vagrant box, syntax check, restart nginx
sudo apt install -y nginx
cp /var/www/html/_install/nginx/default /etc/nginx/sites-available/default
sudo nginx -t
sudo systemctl restart nginx

# mysql (pw 12345678), user "root"
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password $PASSWORD"
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $PASSWORD"
sudo apt-get install -y mysql-server
sudo apt-get install -y php8.1-mysql

# run SQL statements
sudo mysql -h "localhost" -u "root" "-p${PASSWORD}" < "/var/www/html/_install/mysql/01-create-database.sql"
sudo mysql -h "localhost" -u "root" "-p${PASSWORD}" < "/var/www/html/_install/mysql/02-create-table-song.sql"
sudo mysql -h "localhost" -u "root" "-p${PASSWORD}" < "/var/www/html/_install/mysql/03-insert-demo-data-into-table-song.sql"

# phpmyadmin (and add symlink to it's reachable via /phpmyadmin)
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/dbconfig-install boolean true"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/app-password-confirm password $PASSWORD"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/admin-pass password $PASSWORD"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/app-pass password $PASSWORD"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect nginx"
sudo apt-get install -y phpmyadmin
sudo ln -s /usr/share/phpmyadmin /var/www/html/public/phpmyadmin

# install Composer
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

# install Git
sudo apt-get install -y git

# initial composer install, necessary to make the whole application work
cd /var/www/html && composer update

# delete demo file from nginx
cd /var/www/html && rm index.nginx-debian.html

# clickable link
echo "Hello, Hello! Click to start: http://192.168.56.77"
13 changes: 0 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
{
"name": "panique/mini3",
"description": "MINI3 - an extremely simple naked PHP application",
"type": "project",
"license": "MIT",
"authors": [
{
"name": "Panique",
"email": "[email protected]"
},
{
"name": "John Dias",
"email": "[email protected]"
}
],
"minimum-stability": "dev",
"require": {},
"autoload":
Expand Down