Sometimes you have MySQL database, where the user should be able to only do basic database actions, like Create, Read, Update or Delete database records. And you probably know this non-technical user (preferred use-case), so you don’t want to give them access to phpMyAdmin, which is often too difficult, or let alone give them command line access. So you need some simple database forms/pages, but you don’t want to handcode the same PHP CRUD pages again!
Now you can use Cruddiy (CRUD Do It Yourself) to quickly generate clean CRUD pages with zero code.
You’ve probably seen pages like this a thousand times before. And now you can make them with just a few clicks.
I got tired of programming the same pages over and over again for some simple database actions. So in classic yakshaving fashion I decided to automate this, and built a generator that generates PHP CRUD pages.
Cruddiy is a no-code PHP generator that will generate PHP Bootstrap CRUD pages for your MySQL tables.
Cruddiy output is an /app folder which includes everything you need. You can move this folder anywhere you want and delete Cruddiy when your done.
Most MVC frameworks (e.g. Symfony, Django, Yii2) are also able to generate CRUD pages for you. I have used all of these. But more often than not you end up with 80 Megabytes of code (no joke) with all kinds of dependencies that you need to deploy and maintain for just a couple of PHP pages! This rubs me the wrong way. And of course there are many PHP Crud generators around, but they are not libre or more often than not built on top other larger frameworks. Or they simply lacked something else. I couldn’t find anyone that fit my needs, so I first and foremost built Cruddiy for myself.
Goals and characteristics
- No dependencies, just pure PHP (and Bootstrap CDN).
- Written in PHP and output in PHP. So when the generator runs correctly, your generated app will run correctly.
- Just generate what’s needed, nothing else.
- If it wasn’t obvious from the above, the app it generates should be small. Kilobytes not megabytes.
- Cruddiy generates everything in one single /app folder. You can move this folder anywhere. You don’t need Cruddiy after generating what you need.
- Bootstrap looks clean and is relatively simple and small. I use Bootstrap 3 because I like and know it a bit better than 4.
- Love it or hate it: but PHP is ubiquitous. You can download Cruddiy on most webservers and you’re good to go. wget the zip -> unpack -> surf to the folder in your browser and follow instructions.
- Cruddiy is of course a sort of templating engine. It stamps out code based on templates. And if PHP is anything it is in fact by default a template engine itself. So it’s a pretty good language for this kind of thing.
- Cruddiy only works with MySQL (for now): and MySQL and PHP are of course two peas in a pod.
Cruddiy does follow not the MVC paradigm!
Yes, looks elsewhere if you need this. This is not a framework.
Your code is full of dirty hacks
Sure, the generator does quite a bit of array mangling and dirty string replacement, but the PHP pages Cruddiy generates are as clean as they come. And when you’re done generating pages, you can just delete Cruddiy. It completely builds a self-contained portable app that will run on almost any webserver with PHP (i.e. most).
Your generated code is incomplete
At the moment what’s lacking is error value checking on database inserts/updates (all fields are required and it doesn’t check field types: integers vs dates etc.). These will throw general errors or don’t do anything at all. I will probably improve this, but for most use-cases (see above) this should not be a problem. The generated code does use prepared statements and should not be vulnerable to SQLi. But hey, please drop me a line if you find something!
I might add these things:
- Bootstrap 4 theme
- Export to CSV or XLS (users probably want this more often than not)
- Rearrange column order
- Search records (at the top of the page)
- User registration (simple table with username and password: .htaccess works for now)
- Define table relations (use for cascading deletes etc.)
- More specific field types (ENUM = drop-down list etc.)
- More and better input validation
- Catch more database errors
Also published on Medium.