{"id":13669335,"url":"https://github.com/panique/mini","last_synced_at":"2025-05-15T02:07:01.935Z","repository":{"id":11677143,"uuid":"14187237","full_name":"panique/mini","owner":"panique","description":"Just an extremely simple naked PHP application, useful for small projects and quick prototypes. Some might call it a micro framework :)","archived":false,"fork":false,"pushed_at":"2022-09-17T18:36:01.000Z","size":2998,"stargazers_count":1354,"open_issues_count":22,"forks_count":479,"subscribers_count":108,"default_branch":"develop","last_synced_at":"2025-05-10T03:14:03.150Z","etag":null,"topics":["framework","micro-framework","mini","mvc","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/panique.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-06T22:13:20.000Z","updated_at":"2025-04-12T08:47:38.000Z","dependencies_parsed_at":"2022-09-07T09:11:55.376Z","dependency_job_id":null,"html_url":"https://github.com/panique/mini","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panique%2Fmini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panique%2Fmini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panique%2Fmini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panique%2Fmini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/panique","download_url":"https://codeload.github.com/panique/mini/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254259383,"owners_count":22040820,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["framework","micro-framework","mini","mvc","php"],"created_at":"2024-08-02T08:01:10.270Z","updated_at":"2025-05-15T02:07:01.913Z","avatar_url":"https://github.com/panique.png","language":"PHP","readme":"![MINI - A naked barebone PHP application](_install/mini-logo.png)\n\n# MINI\n\nMINI is an extremely simple and easy to understand skeleton PHP application, reduced to the max.\nMINI is NOT a professional framework and it does not come with all the stuff real frameworks have.\nIf you just want to show some pages, do a few database calls and a little-bit of AJAX here and there, without\nreading in massive documentations of highly complex professional frameworks, then MINI might be very useful for you.\nMINI is easy to install, runs nearly everywhere and doesn't make things more complicated than necessary.\n\nFor a deeper introduction into MINI have a look into this blog post:\n[MINI, an extremely simple barebone PHP application](http://www.dev-metal.com/mini-extremely-simple-barebone-php-application/).\n\n## Features\n\n- extremely simple, easy to understand\n- simple but clean structure\n- makes \"beautiful\" clean URLs\n- demo CRUD actions: Create, Read, Update and Delete database entries easily\n- demo AJAX call\n- tries to follow PSR 1/2 coding guidelines\n- uses PDO for any database requests, comes with an additional PDO debug tool to emulate your SQL statements\n- commented code\n- uses only native PHP code, so people don't have to learn a framework\n\n## Forks of MINI\n\n### TINY\n \nMINI has a smaller brother, named [TINY](https://github.com/panique/tiny). It's similar to MINI, but runs without \nmod_rewrite in nearly every environment. Not suitable for live sites, but nice for quick prototyping.\n \n### MINI2 \n \nMINI also has a bigger brother, named [MINI2](https://github.com/panique/mini2). It's even simpler, has been built \nusing Slim and has nice features like SASS-compiling, Twig etc.\n\n### MINI3\n \n[MINI3](https://github.com/panique/mini3) it the successor of MINI, \nusing the original MINI1 native application structure (without Slim \nunder the hood), but with proper PSR-4 autoloading, multiple model \nclasses and real namespaces.\n\n## Requirements\n\n- PHP 5.3.0+ (when first released), now it works fine with current stable versions PHP 5.6 and 7.1, 7.2., 7.3 and 7.4. \n  The latest PHP 8.0 is not tested yet but should also work fine.\n- MySQL\n- mod_rewrite activated (tutorials below, but there's also [TINY](https://github.com/panique/tiny), a mod_rewrite-less \nversion of MINI)\n\n## Installation (in Vagrant, 100% automatic)\n\nIf you are using Vagrant for your development, then you can install MINI with one click (or one command on the\ncommand line) [[Vagrant doc](https://docs.vagrantup.com/v2/getting-started/provisioning.html)]. MINI comes with a demo \nVagrant-file (defines your Vagrant box) and a demo bootstrap.sh which automatically installs Apache, PHP, MySQL, \nPHPMyAdmin, git and Composer, sets a chosen password in MySQL and PHPMyadmin and even inside the application code, \ndownloads the Composer-dependencies, activates mod_rewrite and edits the Apache settings, downloads the code from GitHub\nand runs the demo SQL statements (for demo data). This is 100% automatic, you'll end up after +/- 5 minutes with a fully \nrunning installation of MINI2 inside an Ubuntu 14.04 LTS Vagrant box.\n\nTo do so, put `Vagrantfile` and `bootstrap.sh` from `_vagrant` inside a folder (and nothing else). \nDo `vagrant box add ubuntu/focal64` to add Ubuntu 20.04 LTS 64bit to Vagrant (unless you already have \nit), then do `vagrant up` to run the box. When installation is finished you can directly use the fully installed demo \napp on `192.168.33.44` (you can change this in the Vagrantfile). As this just a quick demo environment the MySQL \nroot password and the PHPMyAdmin root password are set to `12345678`, the project is installed in `/var/www/html/myproject`. \nYou can change this for sure inside `bootstrap.sh`. Shut down the box with `vagrant halt`\n\n## Auto-Installation on Ubuntu 14.04 LTS (in 30 seconds)\n\nYou can install MINI including Apache, MySQL, PHP and PHPMyAdmin, mod_rewrite, Composer, all necessary settings and \neven the passwords inside the configs file by simply downloading one file and executing it, the entire installation \nwill run 100% automatically. Find the tutorial in this blog article: \n[Install MINI in 30 seconds inside Ubuntu 14.04 LTS](http://www.dev-metal.com/install-mini-30-seconds-inside-ubuntu-14-04-lts/)\n\n## Installation\n\n1. Edit the database credentials in `application/config/config.php`\n2. Execute the .sql statements in the `_install/`-folder (with PHPMyAdmin for example).\n3. Make sure you have mod_rewrite activated on your server / in your environment. Some guidelines:\n   [Ubuntu 14.04 LTS](http://www.dev-metal.com/enable-mod_rewrite-ubuntu-14-04-lts/),\n   [Ubuntu 12.04 LTS](http://www.dev-metal.com/enable-mod_rewrite-ubuntu-12-04-lts/),\n   [EasyPHP on Windows](http://stackoverflow.com/questions/8158770/easyphp-and-htaccess),\n   [AMPPS on Windows/Mac OS](http://www.softaculous.com/board/index.php?tid=3634\u0026title=AMPPS_rewrite_enable/disable_option%3F_please%3F),\n   [XAMPP for Windows](http://www.leonardaustin.com/blog/technical/enable-mod_rewrite-in-xampp/),\n   [MAMP on Mac OS](http://stackoverflow.com/questions/7670561/how-to-get-htaccess-to-work-on-mamp)\n\nMINI runs without any further configuration. You can also put it inside a sub-folder, it will work without any \nfurther configuration.\nMaybe useful: A simple tutorial on [How to install LAMPP (Linux, Apache, MySQL, PHP, PHPMyAdmin) on Ubuntu 14.04 LTS](http://www.dev-metal.com/installsetup-basic-lamp-stack-linux-apache-mysql-php-ubuntu-14-04-lts/)\nand [the same for Ubuntu 12.04 LTS](http://www.dev-metal.com/setup-basic-lamp-stack-linux-apache-mysql-php-ubuntu-12-04/).\n\n## Server configs for\n\n### nginx\n\n```nginx\nserver {\n    server_name default_server _;   # Listen to any servername\n    listen      [::]:80;\n    listen      80;\n\n    root /var/www/html/myproject/public;\n\n    location / {\n        index index.php;\n        try_files /$uri /$uri/ /index.php?url=$uri;\n    }\n\n    location ~ \\.(php)$ {\n        fastcgi_pass   unix:/var/run/php5-fpm.sock;\n        fastcgi_index  index.php;\n        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;\n        include fastcgi_params;\n    }\n}\n```\n\nA deeper discussion on nginx setups can be found [here](https://github.com/panique/mini/issues/55).\n\n## Security\n\nThe script makes use of mod_rewrite and blocks all access to everything outside the /public folder.\nYour .git folder/files, operating system temp files, the application-folder and everything else is not accessible\n(when set up correctly). For database requests PDO is used, so no need to think about SQL injection (unless you\nare using extremely outdated MySQL versions).\n\n## Goodies\n\nMINI comes with a little customized [PDO debugger tool](https://github.com/panique/pdo-debug) (find the code in\napplication/libs/helper.php), trying to emulate your PDO-SQL statements. It's extremely easy to use:\n\n```php\n$sql = \"SELECT id, artist, track, link FROM song WHERE id = :song_id LIMIT 1\";\n$query = $this-\u003edb-\u003eprepare($sql);\n$parameters = array(':song_id' =\u003e $song_id);\n\necho Helper::debugPDO($sql, $parameters);\n\n$query-\u003eexecute($parameters);\n```\n\n## Why has the \"Error\" class been renamed to \"Problem\"?\n\nThe project was written in PHP5 times, but with the release of PHP7 it's not possible anymore to name a class\n\"Error\" as PHP itself has a internal Error class now. Renaming was the most simple solution, compared to other\noptions like \"ErrorController\" etc. which would add new problems like uppercase filenames etc. (which will not\nwork properly on some setups). \n\n## License\n\nThis project is licensed under the MIT License.\nThis means you can use and modify it for free in private or commercial projects.\n\n## My blog\n\nAnd by the way, I'm also blogging at [Dev Metal](http://www.dev-metal.com).\n\n## Quick-Start\n\n#### The structure in general\n\nThe application's URL-path translates directly to the controllers (=files) and their methods inside \napplication/controllers. \n\n`example.com/home/exampleOne` will do what the *exampleOne()* method in application/controllers/home.php says.\n\n`example.com/home` will do what the *index()* method in application/controllers/home.php says.\n\n`example.com` will do what the *index()* method in application/controllers/home.php says (default fallback).\n\n`example.com/songs` will do what the *index()* method in application/controllers/songs.php says.\n\n`example.com/songs/editsong/17` will do what the *editsong()* method in application/controllers/songs.php says and\nwill pass `17` as a parameter to it.\n\nSelf-explaining, right ?\n\n#### Showing a view\n\nLet's look at the exampleOne()-method in the home-controller (application/controllers/home.php): This simply shows\nthe header, footer and the example_one.php page (in views/home/). By intention as simple and native as possible.\n\n```php\npublic function exampleOne()\n{\n    // load view\n    require APP . 'views/_templates/header.php';\n    require APP . 'views/home/example_one.php';\n    require APP . 'views/_templates/footer.php';\n}\n```  \n\n#### Working with data\n\nLet's look into the index()-method in the songs-controller (application/controllers/songs.php): Similar to exampleOne,\nbut here we also request data. Again, everything is extremely reduced and simple: $this-\u003emodel-\u003egetAllSongs() simply\ncalls the getAllSongs()-method in application/model/model.php.\n\n```php\npublic function index()\n{\n    // getting all songs and amount of songs\n    $songs = $this-\u003emodel-\u003egetAllSongs();\n    $amount_of_songs = $this-\u003emodel-\u003egetAmountOfSongs();\n\n   // load view. within the view files we can echo out $songs and $amount_of_songs easily\n    require APP . 'views/_templates/header.php';\n    require APP . 'views/songs/index.php';\n    require APP . 'views/_templates/footer.php';\n}\n```\n\nFor extreme simplicity, all data-handling methods are in application/model/model.php. This is for sure not really\nprofessional, but the most simple implementation. Have a look how getAllSongs() in model.php looks like: Pure and\nsuper-simple PDO.\n\n```php\npublic function getAllSongs()\n{\n    $sql = \"SELECT id, artist, track, link FROM song\";\n    $query = $this-\u003edb-\u003eprepare($sql);\n    $query-\u003eexecute();\n    \n    return $query-\u003efetchAll();\n}\n```\n\nThe result, here $songs, can then easily be used directly\ninside the view files (in this case application/views/songs/index.php, in a simplified example):\n\n```php\n\u003ctbody\u003e\n\u003c?php foreach ($songs as $song) { ?\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003c?php if (isset($song-\u003eartist)) echo htmlspecialchars($song-\u003eartist, ENT_QUOTES, 'UTF-8'); ?\u003e\u003c/td\u003e\n        \u003ctd\u003e\u003c?php if (isset($song-\u003etrack)) echo htmlspecialchars($song-\u003etrack, ENT_QUOTES, 'UTF-8'); ?\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n\u003c?php } ?\u003e\n\u003c/tbody\u003e\n```\n\n## History\n\nMINI is the successor of php-mvc. As php-mvc didn't provide a real MVC structure (and several people complained\nabout that - which is totally right!) I've renamed and rebuild the project.\n\n## Dear haters, trolls and everything-sucks-people...\n\n... MINI is just a simple helper-tool I've created for my daily work, simply because it was much easier to setup and to\nhandle than real frameworks. For daily agency work, quick prototyping and frontend-driven projects it's totally okay,\ndoes the job and there's absolutely no reason to discuss why it's \"shit compared to Laravel\", why it does not follow \nseveral MVC principles or why there's no personal unpaid support or no russian translation or similar weird stuff. \nThe trolling against Open-Source-projects (and their authors) has really reached insane dimensions.\n\nI've written this unpaid, voluntarily, in my free-time and uploaded it on GitHub to share.\nIt's totally free, for private and commercial use. If you don't like it, don't use it.\nIf you see issues, then please write a ticket (and if you are really cool: I'm very thankful for any commits!).\nBut don't bash, don't complain, don't hate. Only bad people do so.\n\n## Contribute\n\nPlease commit into the develop branch (which holds the in-development version), not into master branch\n(which holds the tested and stable version).\n\n## Changelog\n\n**December 2002**\n- [panique] updated Vagrant installer to run with PHP 7.4 and Ubuntu 20.04\n\n**August 2016**\n- [codebicycle/panique] renamed Error class to Problem to make it PHP7 compatible #209\n- [ynohtna92/panique] URL protocol is now protocol-independent #208\n\n**February 2015**\n- [jeroenseegers] nginx setup configuration\n\n**December 2014**\n- [panique] css fixes\n- [panique] renamed controller / view to singular\n- [panique] added charset to PDO creation (increased security) \n\n**November 2014**\n- [panique] auto-install script for Vagrant\n- [panique] basic documentation\n- [panique] PDO-debugger is now a static helper-method, not a global function anymore\n- [panique] folder renaming\n- [reg4in] JS AJAX calls runs now properly even when using script in sub-folder\n- [panique] removed all \"models\", using one model file now\n- [panique] full project renaming, re-branding\n\n**October 2014**\n- [tarcnux/panique] PDO debugging\n- [panique] demo ajax call\n- [panique] better output escaping\n- [panique] renamed /libs to /core\n- [tarcnux] basic CRUD (create/read/update/delete) examples have now an U (update)\n- [panique] URL is now config-free, application detects URL and sub-folder\n- [elysdir] htaccess has some good explanation-comments now\n- [bst27] fallback for non-existing controller / method\n- [panique] fallback will show error-page now\n- [digitaltoast] URL split fix to make php-mvc work flawlessly on nginx\n- [AD7six] security improvement: moved index.php to /public, route ALL request to /public\n\n**September 2014**\n- [panique] added link to support forum\n- [panique] added link to Facebook page\n\n**August 2014**\n- [panique] several changes in the README, donate-button changes\n\n**June 2014**\n- [digitaltoast] removed X-UA-Compatible meta tag from header (as it's not needed anymore these days)\n- [digitaltoast] removed protocol in jQuery URL (modern way to load external files, making it independent to protocol change)\n- [digitaltoast] downgraded jQuery from 2.1 to 1.11 to avoid problems when working with IE7/8 (jQuery 2 dropped IE7/8 support)\n- [panique] moved jQuery loading to footer (to avoid page render blocking)\n\n**April 2014**\n- [panique] updated jQuery link to 2.1\n- [panique] more than 3 parameters (arguments to be concrete) are possible\n- [panique] cleaner way of parameter handling\n- [panique] smaller cleanings and improvements\n- [panique] Apache 2.4 install information\n\n**January 2014**\n- [panique] fixed .htaccess issue when there's a controller named \"index\" and a base index.php (which collide)\n\n## Support the project\n\nSupport the project by renting a server at [DigitalOcean](https://www.digitalocean.com/?refcode=40d978532a20) or just tipping a coffee at BuyMeACoffee.com. Thanks! :)\n\n\u003ca href=\"https://www.buymeacoffee.com/panique\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" style=\"height: 60px !important;width: 217px !important;\" \u003e\u003c/a\u003e\n","funding_links":["https://www.buymeacoffee.com/panique"],"categories":["PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanique%2Fmini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpanique%2Fmini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanique%2Fmini/lists"}