November 2020: Cruddiy now supports creating and deleting table relations (based on foreign keys) for cascading deletes/updates and and prepopulating select lists. Read more here.
So you have a MySQL database and a user who should be able to do some standard database actions, like Create, Read, Update or Delete database records. Nothing fancy.
But this is a non-technical user, so you don’t want to give them access to phpMyAdmin, which is too difficult. Or let alone give them command line access. So you need some simple database forms, built on top of your MySQL database, but you don’t want to handcode the same PHP CRUD pages again!
Now you can use Cruddiy (CRUD Do It Yourself) and quickly generate clean CRUD pages with zero coding.
You’ve probably seen pages like this a thousand times before. And if you have a MySQL database you can now make them yourself with just a few clicks.
Above is the old Bootstrap 3 look. This is the new Bootstrap 4 look:
I got tired of programming the same pages over and over again for some simple database forms. 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.
The output of Cruddiy is an /app folder which includes everything you need. You can rename and move this folder anywhere you want and even delete Cruddiy when you’re done (or run it a couple of times more to get your app just the way you like it). Cruddiy is only used to generate the /app folder. And the /app folder is what your user will use.
Why Cruddiy, tool xyz does the same thing!
Most MVC frameworks (e.g. Symfony, Django or Yii2) are of course also able to generate CRUD pages for you. I have used all of these. But usually you end up with at least 80 Megabytes of code (no joke) and 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 other PHP Crud generators around, but they are not libre or, more often than not, built on top other larger frameworks: so they have the same problem. Or they simply lack something else. So when I couldn’t find anyone that fit my needs I decided to make Cruddiy.
Cruddiy goals and characteristics
- Simple
- No dependencies, just pure PHP.
- Written in PHP and output in PHP. When the generator runs correctly, your generated app will run correctly.
- Clean
- Just generate what’s needed, nothing else.
- Small
- If it wasn’t obvious from the above, the app it generates should be small. Kilobytes not megabytes.
- Portable
- 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
- Bootstrap looks clean and is relatively simple and small.
I use Bootstrap 3 because I like and know it a bit better than 4.
- Bootstrap looks clean and is relatively simple and small.
FAQ
Why PHP?
- 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 -> check webserver permissions (chmod) -> surf to the unpacked 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: and MySQL and PHP are of course two peas in a pod.
Cruddiy does not follow the MVC paradigm!
Yes, look elsewhere if you need this. This is not a framework. This is a form generator.
Your code is full of dirty hacks
Sure, the generator does quite a bit of array mangling and dirty string replacement (hence the name), 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!
Next features?
I might add these things:
- Darkmode
Bootstrap 4 theme✔️ Fixed per 20200803- Export to CSV or XLS (users probably want this more often than not)
- Rearrange column order
Search records (at the top of the page)✔️ Fixed per 20200722- User registration (simple table with username and password: .htaccess works for now)
Define table relations (use for cascading deletes etc.)✔️ Fixed per 20201126- More specific field types (ENUM = drop-down list BOOLEAN = checkbox etc.)
- More and better input validation
- Catch more database errors
Leave a Reply