16

I have to make some database requests with PHP on a MySQL database.

Question : What is the best (simpliest) framework to get thing done right CRUD (Create Read Update Delete)?

I also have to populate the database, what is a good tool to do that. The only one I know is SqlMyAdmin, wich does not look good. An online tool would be great.

Your experience is valuable: tell me what do you use and why ?


I have taken a look at CodeIgniter, looks nice, what do you think... overkill ?

Antonin M.
  • 1,744
  • 1
  • 18
  • 29
menardmam
  • 9,860
  • 28
  • 85
  • 113

11 Answers11

10

For lots of operations (especially CRUD, which work out of the box once you've written the schema files), the ORM Framework Doctrine is really great.

If you want to go farther than just DB access, you might take a look at the PHP FRamework symfony, which provides an admin generator (there is even a screencast about that one). (And has great documentation, such as the jobeet tutorial) (BTW, symfony uses Doctrine as ORM ^^ )

But maybe it's a bit overkill (and requires a too big learning curve) if you need something simple...

To load data to MySQL, what about LOAD DATA INFILE, which (quote from the docs) "reads rows from a text file into a table at a very high speed".

Pascal MARTIN
  • 395,085
  • 80
  • 655
  • 663
7

I recommend GroceryCRUD because of the good engineering and documentation

  1. Copy files into your web folder
  2. Configure MySQL database
  3. Specify MySQL table name

=> You get a paginated JqueryUI table with create/edit/delete buttons.

create/edit opens a form page based on the MySQL table schema. For example, a boolean, a varchar and a text get turned into a form with active/inactive radio buttons, a text field and a wysiwyg html editor.

Note: GroceryCRUD is built on CodeIgniter so you will have a copy living in your admin directory. You don't have to use it for building your main site.

Security Advisory: Any library can have undiscovered security vulnerabilities, so it is recommended to minimize exposure by protecting your copy of GroceryCRUD with BaseAuth and permitting SSL access only.

cmc
  • 4,294
  • 2
  • 35
  • 34
  • For information, this is only for Code Igniter. If you use something else, this lib won't work. – laurent Jan 20 '14 at 16:12
  • @Laurent There is a CI dependancy, but that doesn't force you to build your app with it. – cmc Jan 20 '14 at 16:46
3

I'd second Pascal's comment re Symfony (I would uprate but not enough credit :-() - Symfony has a great admin generator, and once you get your head around the app->module->actions concept, it's straightforward and the documentation is fantastic, even if it is sometimes easier to search Google for it ;-)

Failing that, CakePHP is a lot better now than it used to be back in the early days, and you can get going with the minimum of fuss, particularly with their scaffolding which will help you set up a basic CRUD-style setup. Their documentation is also pretty awesome and very easy to read :-)

richsage
  • 26,912
  • 8
  • 58
  • 65
1

Why do not you try to code it from scratch as CRUD is a common task of programming. There are lots of good tutorials:

1>PHP PDO + Bootstrap Twitter: http://www.lizardgrid.com/blog/php-crud-tutorial-part-1/

2>JQuery + PHP: http://www.codeofaninja.com/2013/05/crud-with-php-jquery.html

Cuong
  • 11
  • 1
1

I am currently testing JqGrid (a Jquery Table Library).

I have tried Grocery CRUD: looks nice, but its Datatables theme (which has column filtering ability) won't work with server-side processing, that's why I dropped it.

Jess Stone
  • 677
  • 8
  • 21
1

You may have a look at Cygnite Framework

It does basic code generation. Controller, model, views, layout, pagination, form component, required field validation, with bootstrap template etc. all these generate with simple command. You may alter the code based on your need.

Here is the tutorial- Generate CRUD application within 2 Min

Worth looking.

appsntech
  • 722
  • 1
  • 6
  • 21
appbird
  • 31
  • 1
1

If solutions such as Doctrine, CAKE, CodeIgniter, etc. seem like overkill for what you're trying to do, I'd recommend a one-file PHP script I built that lets you CRUD hierarchical data in MySQL:

http://coding.pressbin.com/109/PHP-One-file-CRUD-front-end-for-hierarchical-MySQL-data/

jawns317
  • 1,726
  • 2
  • 17
  • 26
0

I'd say that totally depends on what you need to do.

You do know phpMyAdmin, right? You can import from a lot of formats with that tool.

Or do you want to develop an application with simple CRUD operations? Then a framework like Symfony or Zend Framework would be the right thing to be looking for.

mattanja
  • 1,442
  • 14
  • 21
0

Something like http://www.notorm.com/ might be more appropriate than Symfony. Whilst I like Symfony and have used it to great effect, it is not simple.

Likewise with Codeignitor I would argue that any full stack framework (Laravel, Zend, Wii etc . . ) would not fit the remit of "simple".

0

I developed this script which reverse engineers from a MySQL database a set of stored procedures that list all the rows of a table, a single row based on the primary key, updates/inserts based on the primary key and deletes based on the primary key. It assumes that you already have your tables created with the primary keys setup per table and it generates the MySQL stored procedures for you. I have found that this is more efficient than similar types of solutions developed in PHP.

  • I don't see why this was downvoted, this answers the second part of the question perfectly. people need to take care not to downvote stuff just because it doesn't fit their specific standards. – Jonathan DS Feb 15 '12 at 16:29
0

A fairly straight forward and effortless crud system i found is https://github.com/usmanato360/crud360 its very easy to setup and there are loads of advanced features. It is unlike traditional crud systems that generate model classes etc.. it is just a single class that takes care of everything dynamically.

Neo
  • 1