Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Is there any thing in PHP to create basic scaffold, like in Rails?
EDIT: I need something to prototype quickly..
Some frameworks like Symfony, CakePHP, Akelos, CodeIgniter and others have support for scaffolding.
However if you don't want to use a framework you can try phpScaffold which generates CRUD scaffold pages based on phpMyAdmin table exports...
I also wanted some fast prototyping, but I wanted it to generate the code, so it's easy to update it. I made many improvements on phpScaffold (HTML5, nice CSS, many models at once, etc) which are published on http://github.com/tute/phpscaffold.
Phreeze makes this simple and easy. http://phreeze.com/
QCodo is another great option. And since it uses reflection to do Code Generation instead of reflection at runtime, you'll likely see better performance.
First, Rails is a framework. PHP is a language. PHP does not have built-in scaffolding support, just as Ruby--the language Rails is build on--does not. A framework like CakePHP, however, does support scaffolding.
Second, I see that you raised an objection to CakePHP because "you still have to do a bunch of stuff." That's true--with any framework, you're going to have to learn new conventions, configurations etc.
CakePHP got plenty of scaffolding options
If you throw Crud + API plugin on top, you basically got everything you need, with tons of nice additions
cakephp-crud: The active successor of the two projects below. Provides both Crud actions, API, Scaffolding, Searches and more
Crud Plugin: https://github.com/nodesagency/Platform-Crud-Plugin
API Plugin: https://github.com/nodesagency/Platform-API-plugin
They all utilize CakePHP events, so its really simple to extend and modify the default behavior
For myslef I Use CodeIniter for development, sure they have scaffolding, but only in terms of a "simple scaffolding" which mean you're not gonna use it in live product (i dunno about everyone but i'm only using it as some tools) .
but if you need some like CRUD generator you can use SparkPlug , or Ignition both of them can be used on Codeigniter
This was asked quite some time ago, but if it's still relevant check out this nice scaffolding class (check the demo)
Yiiframework has a good code scaffolding system called Gii. It's web based. Once you create the tables, you can generate the CRUD classes from within the browser. No command line needed. I like this scaffolding.
If you use CakePHP as the web framework it supports scafalding. See this link for more info. http://book.cakephp.org/2.0/en/controllers/scaffolding.html
I'm not sure what the SO policy is for dead thread revival but I figured I would add my own two cents in case none of the above solutions were satisfactory. If you're looking for a PHP-based MySQL scaffolding tool, check out AMPLE Scaffolder. The entire package is contained within a single PHP file (less than 200k) that can simply be dropped into a web accessible directory whereupon you have immediate access to local and remote MySQL databases based on the internal database permissions. No schema exporting, configuration files, or other hassles. Plus, there's a whole lot of other capabilities to offer as well. Just thought I'd share it in case you were looking for another option. Feel free to check it out and post feedback if you have any questions.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I intend to develop a Content Management System (CMS) like shown in the figure below;
Figure: Intended CMS design
Is it possible to completely develop it using PHP's standard library?
Do I need to use a PHP web framework? If so, why and what framework is ideal?
I hope to use MySQL as backend.
I hope to use below technologies as front end;
HTML5 and CSS3 - hard code by myself (Is there any framework or something make it easy? I heard something lesscss.org)
jQuery - to make HTML elements functional
Ajax - to avoid page refreshing
Bootstrap - to make my CMS responsive
Are there any technologies I do use, or any suggestions?
I prefer to improve my HTML, CSS, PHP and other technologies by learning and hard coding. So I hope not to use CMS like
joomla, WordPress, etc. Am I right?
Please note: I've already searched Google extensively before I put my questions here. But I am unable to confirm what I do next. Your comments are appreciated.
Your questions really look well researched and I think everybody with the intention of building a custom-made CMS has come to this point where they ask themselves these fundamental questions (in other words: good questions!). Now to some answers:
1) Yes it is possible.
2) Although building a CMS in pure, native, hard-coded PHP is possible, I wouldn't recommend it for production. You could do it, and you would largely profit from the experience, but there are many little problems (like Routing / User-Management / Authentication / Communicating with Database / Form-Building (like in your screenshot) / etc.) that are already solved by a good Framework.
Also as you are a beginner, you are naturally overwhelmed by the problems and decisions you have to solve/make. This is also a good point why a framework would be a good starter. Although some solutions are sometimes a little too opinionated, they still give you a good structure to start with and most of the times follow best practices of our industry.
Which framework is the most ideal for your project, you'll have to decide on your own, based on your requirements, but some common ones are:
Symfony (probably the most known and most used php-framework, but also very abstract / I would recommend this on a really big project, where you work in a team and you are aiming for flexible maintainability)
Laravel (excerpt from their website: An amazing ORM, painless routing, powerful queue library, and simple authentication give you the tools you need for modern, maintainable PHP.)
Silex (the little brother of Symfony, info from their website: Silex is a PHP microframework for PHP. It is built on the shoulders of Symfony2 and Pimple and also inspired by sinatra.)
FatFreeFramework (from their website: A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust web applications - fast!)
As I used Silex myself many times and also when I began with best-practice PHP, I recommend to start with it, if you decide to write your own CMS. I pretty fast did some Management-CMS similar to your screenshot with it (with their Form-Builder) and was happy with the result.
3) Again this is up to you. For the backend you will probably use MySQL anyway, if you just need a database. In the frontend using HTML5/CSS you could try jQuery and Bootstrap (and then here their less or sass implementation).
If you really don't have too much logic for your JavaScript, you could also try to just use native JS, without jQuery. This way you will also learn more about the language and have less vendor-dependencies the user has to download.
4) If you are really up to learning a lot, then yes, you should probably hand-code everything yourself. This way you also have total control of what code gets delivered to your user. That's a problem with most common CMS: they pollute your code through some other plugins or something and you quickly loose control over your output.
But if you need to be fast there are also CMS that address this issue by giving you total control over your output and giving you creative freedom, like MODX does.
In the end it is up to you and especially the needs of your project. If it's a simple website and you conveniently want to edit the content and also have some starter-help, then I recommend to use a CMS.
If you really want to learn about all this stuff and you have some special needs, then go on and code your custom-coded application. In any way: good luck! :)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Since Symfony 1.x's admin generator, I found this kind of tool really useful to prototype applications, show something very quickly to customers etc.
Now for Symfony2, admin generator does not seems to be a priority (see here and here)
Django's admin generator seems very interesting...
Which web application admin generator (any language / technology) would you recommend (pros / cons)?
Django's automatic admin app is excellent. Once you've written your models, it automatically creates a full-featured admin app around them where you can create, update and delete records. It's also extensible and customizable for just about whatever you need.
Here's a pretty good overview about it. Django (and python) is intuitive and satisfying to work with -- I highly recommend that you set it up and play with it and see how well it works.
Updated 2017
Agile UI (a successor of atk4.3) is an MIT based PHP UI Component library. It gives your application nice looking, consistent User Interface without you have to write any HTML and works with any PHP framework or application.
Demo: http://ui.agiletoolkit.org/demos/index.php
The reason I think this is better than a built-in generator:
Almost no dependencies, works with any framework or PHP app.
Can work with SQL or NoSQL, relies on Agile Data.
Stylish, modern and responsive. (Semantic UI)
Interactive. "Form" uses JS to submit, display in-line validation. "CRUD" uses modal windows, pagination and QuickSearch.
Extensible. Need charts? https://github.com/atk4/chart.
Open-source
To build a minimalistic application admin you only need 15 lines of PHP code:
<?php
$app = new \atk4\ui\App('My App');
$app->initLayout(new \atk4\ui\Layout\Admin());
$db = \atk4\data\Persistence::connect($DSN);
class User extends \atk4\data\Model {
public $table = 'user';
function init() {
parent::init();
$this->addField('name');
$this->addField('email', ['required'=>true]);
$this->addField('password', ['type'=>'password']);
}
}
$app->layout->add(new \atk4\ui\CRUD())
->setModel(new User($db));
Result:
Personally, I have found Yii's scaffolding is the best there is. Quick First Application
What I truly loved:
Controlled creation of files. Yii provides an interface to create all required files, called Gii.
You have the ability to generate your model classes based on the database model.
You have the ability to generate CRUD operations for all your model classes (Action methods for your controller class).
The generated scaffolding includes: Pagination, Searching, Advanced Searching, Listening, Inserting and Updating includes validation out of the box, Deleting. And all of the interface is ajax driven.
For Ruby on Rails: Here is some discussion on SO
But ActiveScaffold's home page at the moment is still talking about Rails 2.3, so you may want to read past the accepted answer and check the others to see if there are newer ones.
Rails Admin looks to be actively developed and has good pedigree (having been a Google Summer of Code project mentored by big names in the Rails community, so I'd start there if I were looking.
I can recommend CakePHP scaffolding, where you can also add admin routing. Nice for you is that you can stay on PHP, which you also used for Symphony. Be warned, you might get addicted to Cake ;)
something a lot more powerful for CakePHP is https://github.com/josegonzalez/cake_admin, little bit of a Django rip-off :)
I like sprox, for Python. Although I have not found it particularly useful for production, it can help a lot in terms of prototyping and testing -- its simplicity is its strength here, enhancing Python's own strengths.
Padrino has "Padrino Admin":
http://www.padrinorb.com/guides/padrino-admin
While not as popular as Rails, it's built around the excellent Sinatra DSL.
For Rails applications, Rails Admin with CanCan is the best solution as of now. These are very actively maintained and supports Rails 3.0. With CanCan, you can customize access on models. So that you can easily set multiple level of admins/authors. Previously I have used ActiveScaffold for 2.0 application but it doesn't seem to support newest Rails.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
Ok so before anyone states the fact that the php framework question has already been answered, note that I am asking questions specifically on which framework would be best given the requirements that I am providing. I am currently in the proccess of building a large project. I will be in the future working on several medium/large and a few small projects. I am an experienced php developer and fully know OOP inside and out and have a great knowledge of mysql database so learning a system is not a problem.
Now that is out of the way down to what I am actually looking for. I have currently been using a "framework" that is not so great and was provided to me for my projects. I would like to get rid of the "framework" and actually start using an actual framework. I was thinking of building my own framework but was considering (and really leaning towards) using an already preexisting framework. I have looked at a bunch of frameworks and even played with a few of them out there. Once I choose a framework I am going to want to keep using it and not have to switch 6 months down the road so before I choose I will be doing some thorough testing before making the final decision. I would like to get some input from some users as to which ones would fit my needs best.
In a framework I am looking for the following items:
Speed - because of being larger projects I will need to keep speed in mind. I can write efficient code but if the framework is slow it really wont matter now will it :)
Authentication - I would like to be able to use some built in authentication if possible through the framework. I dont necessarily need granular permissions based on users but more or less through groups (granular permissions is not a turn off just not a requirement).
Ajax - I like to use ajax in my applications so I would like some kind of ajax implementation in the framework and personally I prefer jquery. It doesnt necessarily need to have built in ajax features but a way to kill the page with the ajax output before anything is output for efficiency.
Forms - I have seen that alot of frameworks have built in features for managing forms but just thought I would mention it here to save myself the headache.
Administration - This is possibly one of the most required features that I really need. I need to be able to create a backend to manage the site. I dont want to have to hack something together to make this work.
Api - I will be in need of an api for accessing/modifying data that I will be allowing.
Database - Built in database methods. Doesnt necessarily need to do it automatically, just give me access to be able to retrieve/update the data that is need.
These are not neccessarily requirements but more or less nice features:
I would like to be able to encase all of my data that goes with a certain item into a "module" of a sort. So that I could easily copy it to another site and have it all ready to go.
An easy to navigate structure. I would like to be able to go into controllers and not see 50 files but instead see maybe 10 folders with the files encased in the folders so that it is better separated.
I cant really think of anything else at this time but if I think of anything else I will update the post. I would really like to get feedback from people who are using any frameworks out there. If you havent messed with a framework please do not recommend it as you have no experience with it and will not know if it would suit my needs. Any help is appreciated.
EDIT:
I just wanted to edit this post to clarify some stuff. In the requirements/features that I am looking for I do not necessarily need all of the features to be built into the framework. From some of the responses it seemed as if people were thinking that all of this stuff has to be pre-ready. I more or less am looking for a framework that supports all of the features that I am looking for that is easily accomplished with the components in the framework. For example the administration, it does not have to have a default administration area but allow for me to create an administration easily from the components that I will be adding to the site.
From my own experience ( CodeIgniter , Zend Framework ), but realy all major frameworks will allow you to do everithing you asked .
Speed - CodeIgniter is the fastest i worked with , this is not the strongest feature of ZF , in fact where i work we all got to the conclusion that ZF is slow .
Auth - Zend Framework handles auth better than what i saw in other frameworks
Ajax - All major Frameworks will allow you do disable the layout/view , Zend is slightly better here , as you can have special json views.
Forms - CodeIgniter framework handles forms easyer than ZF , however all frameworks should deal with this problem with ease . Symfony needs to be mentioned here with it's form generator .
Administration - Symfony just becouse it has a nice crud form generator based on the tables you're passing ( "admin generator" how they are advertising it ) , witch will speed development quite a bit .
???
Database - ZF handles databases nicer in my opionion , however i've heard good things about Symfony too . CodeIgniter here is not that strict witch is not a good thing in my opinion .
Modular App - Building modules in ZF is realy easy , and the feature that i like most is that a module structure looks like the whole app itself ( eg. the whole app is a module ... )
Easy to navigate structure - All of them once you are used to it , however i don't like the fact that CodeIgniter keeps all it's controllers in one place , when in ZF you can add modules and separate things from one and another .
Well, I worked with several PHP frameworks in the past and there aren't many good frameworks. You could risk a look at Zend Framework
ok
ok (but not enterprise level)
ok, but dojo
complicated
no, its a framework, not an application
ok, but not really a ERM
encapsulates PDO in an ugly way (bad implemented factory pattern)
ZF is developed by Zend itself, but I wasn't really happy with that too, because it has a lot of shortcomings (cruel DBAL, complicated form handling, supports dojo instead of jQuery) and if you are used to Java/JBOSS or .NET it just sucks (only mentioning this because you are planning a big project).
If you have some time until your project needs to be deployed and if you dont need to start immediately, you could also try FLOW3 (still alpha) which is developed by the TYPO3 Team. I've played a little bit with FLOW3 and can say that it is the only PHP FW which has at least a good architecture and some good ideas/paradigms (AOP e.g.).
If I understand you in the right way you would need something like a CMS for your backend. Maybe it would be a good idea to evaluate exiting CMS's and check out if you could extend them (use the CMS as framework (TYPO3 e.g.)).
You wont find a FW that matches exactly your needs, therefore you should consider choosing a CMS/FW and customize it in the way you need it. If the project is as big as I imagine there should be enough resources for such task.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
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 ?
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".
I recommend GroceryCRUD because of the good engineering and documentation
Copy files into your web folder
Configure MySQL database
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.
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 :-)
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/
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
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.
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.
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.
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.
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".
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.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have a moderately simple assignment, to create a PHP/PDO site with login functionality and article retrieve/save/edit/search. No tags, nothing else.
Is this overkill to use some framework for this?
It it a good decision to use custom code + perhaps template system like Smarty for a simple site that will not grow too much?
Is there a software niche/best practices for small sites?
In a nutshell, I need logins/forms, but aren't frameworks like Zend or Cake too much for this?
I think that you can never go wrong by adding a framework to any size project. Anytime you can reuse something (and not reinvent the wheel) or leverage an existing code base to speed application development time, then do it.
Besides, you never know when your small to mid-size project suddenly grows to a large project. At least then you will have the pieces in place to grow your application and not have to start from scratch.
I'm a big fan of CodeIgniter, it would make setting up a simple website like this pretty painless. There is a fairly extensive stackoverflow answer about authentication libraries for CodeIgniter which would make login a breeze.
I would not suggest using a third party template library such as smarty. CodeIgniter has helper functions which can be used within 'views' which will allow you to do a lot of things quickly and painlessly, such as form creation.
I think using a framework is ideal for simple projects. They're quicker to set up and get going with. A framework may not be ideal if you need to fine tune how the site will run for reasons such as scalability or special requirements, or because you just don't like frameworks.
I'd suggest just using whatever parts of the Zend Framework you feel you need. Zend is very 'pick and choose' friendly.
That said, I recently used the ZF Application (MVC collection) for a two page site, just because it made things so easy. You don't need to have multiple controllers/models/view helpers to justify using a MVC framework.
Please don't user smarty. It's really unnecessary. PHP is it's own template language.
These posts on sitepoint tell the story well: #1, #2, #3
I've been using Kohana and I like it.
http://www.kohanaphp.com/
This guide got me started Kohana 101
For something that simple you can use a tiny framework like MicroMVC which comes with a equally small PDO based ActiveRecord-like database class.