Ruby on Rails has a bunch of plugins which extend the normal scaffolding:
Lipsiadmin
Hobo
Streamlined
ActiveScaffold
Does the PHP community have anything similar? phpmyadmin is great, but it doesn't have any way to control the presentation of the data. You always get all of the data in its presentation format. These Rails frameworks are a little more user friendly.
Edit: My original question was not very clear. I'm not looking to compare PHP and Rails. I'm also not looking for an all purpose general framework. I'm looking for something just like the four pieces of software I listed above, but written in PHP. The admin software I listed above generates a crud interface for you based on your configuration. The configuration includes which tables you'd like to show, what operations you can do to the table, and who can see the information. The software does the rest, from writing the SQL to processing the request to generating the interface.
I would look at Zend, CakePHP, CodeIgniter or Kohana. See if they have an addon or plugin that can do it.
The problem with the four pieces of software you listed is that they extend Rails. When you say "PHP," there is nothing to extend in the same sense. (I really doubt you want a PHP module that does this.) You don't need a PHP addon, you need a [framework] addon.
Any of the frameworks I or Jonathan listed are similar to Rails. Kohana in particular has an addon module called Auto Modeler that may do what you need.
have you looked at pear: http://pear.php.net/
It's important to stress the difference between a language and a framework here. PHP is not itself a framework with modules. PHP is a language, like C or Python.
There are several website frameworks that have been written in PHP. The most popular would probably be Drupal though there are several that I've looked at over the last year that seem similarly capable:
CakePHP
CodeIgniter
Joomla!
Symfony
Zend
PhpMyAdmin is not a module or a framework. It is a separate, stand-alone web application for database administration, written in PHP. It won't be a component in any strategy for presentation of data on a website.
Symfony may be a "general framework", but it has scaffolding you can use as a complete application if your needs are simple. You define your model in a YML config file, and can then generate CRUD modules based on this model. The code generation is also customizable by editing other YML config files. All without writing any PHP code. But should the need arise, you have the option to extend the scaffolding with PHP and the complete framework.
See the Symfony docs on code generation.
A framework called ATK also claims a good code:functionality ratio ("An application in 10 lines of code").
Related
I have experience with Joomla and have modified and wrote some simple Joomla extensions. I don't have experience using one of the popular PHP frameworks (such as CakePHP), but I was thinking about using the Joomla framework because I'm familiar with Joomla. How would I use the Joomla framework for a software project instead of using regular Joomla and writing the extensions needed for it to extend it's capabilities? Thanks!
The basic idea is that you:
Get a copy of either the whole framework or just the packages you need+dependencies (from github or composer) or use the older copy that is shipped with the CMS,
Bootstrap your application (JApplicationWeb or JApplicationCli).
Write your code using the MVC structure provided.
The big difference with writing a totally independent application is that you are doing just that, you need to build everything in the application whereas in the CMS there are already a lot of things in place. (The good part of that is that you can make new code with no legacy concerns.) For example, if you look at the JIssues project you'll see that they had to think about things like authentication. So as you would expect writing a simple application is simple, writing a complex one is complex.
You can see many examples of framework applications around, ranging from the ones found in the CLI folder of your CMS installation to JIssues, and of course the three web applications in the CMS are all examples of applications on the framework.
The Joomla Framework is intended (among other things) to be the platform upon which you can build a web-application. The framework is like the frame of one of those motorcycles they build on "American Choppers." It provides the backdrop so that you can hit the ground thinking about your app without worrying about User Authentication, database connection, and a thousand other things like those that get in the way of bringing your app to its potential audience.
If you're trying to extend Joomla, the current edition is what you should be using.
I'm wondering if there are any abstraction frameworks for one of the PHP gui libraries. We have PHP-GTK, a PHP/Tk interface, and seemingly also PHP-QT. (Not tried any.)
I know that writing against the raw Gtk+ interface in Python is just bearable, and it therefore seems not very enticing for PHP. I assume it's the same for Qt, and Tk is pretty low-level too. So I'm looking for something that provides a nicer object structure atop any of the three. Primarily TreeViews are always a chore and php-gtk callbacks are weird in PHP, so I'd like a simplification for that. If it eases adding the GUI/View atop my business logic without much control code, that might already help.
And so since GUI apps are an area where MVC or MVP would actually make sense, I'd like to know if any library for that exists.
Still open for answers.
(There will probably be a second bounty round. It's an uncommon topic, so needs more research.)
[Not an answer. Just wanted to remove this from the question, as it's only related, not a solution.]
There is the PHP interface preprocessor. However it is very simple and low-level. It provides an output interface for Gtk, as well as ncurses, but also PDF or XHTML serialization. Which is interesting, as it's close to real MVC constructs in allowing to exchange the View for different backends without adapting the Controller even. But then it only provides the basic widgets, and not a whole lot of simplifications. Thus I only consider it related to my original question. So, a side note.
Have you tried WinBinder? Not exactly MVC related, but a very nice extension to create gui based programs in PHP.
Now there are a few options that work on newer versions of php. Some of these do not provide you with MVC out of the box, but you can use them to make GUI application in php.
There is the very easy to use php-gui. It does not require any special php extentions, you can just install it with composer like any other php library or framework you depend on. It is geared toward simple, standard user interfaces.
If you need to make something very custom and graphically advanced, and are willing to use an API that was designed to make games in C (or if you want to make a game in php), you could use OpenGL via SDL via FFI via ffi-sdl. It currently (as of 6/1/2020) requires php 7.4 or greater as it uses the recently added ffi feature of php. Even though this relies on the ffi extension, php-ffi is still easy to add to your project. It is still sort of extensionless (like php-gui) because there are no extensions tailor made just for this for it to work. Unlike some other extensions, there is not much chance ffi will not be maintained since it is a feature of php itself. Most people will just need to add ff-sdl to their project using composer, and possibly enable ffi in their php.ini.
I just learned you could also use PeachPie. It allows you to compile and run php code for/on .NET, so you would gain access to .NET GUI libraries, including MVC ones.
I really doubt that you'll find anything like that ready to use OotB. PHP GUI programming has totally failed few years ago.
What you can do however, is use some kind of bridge to interface decent MVC from another language. Which PHP you have following choices:
PHP/Java bridge http://php-java-bridge.sourceforge.net/pjb/
Boost.PHP (C++) https://github.com/moriyoshi/boost.php/wiki
SWIG (C, C++ via wrappers) http://www.swig.org/
http://phpketchup.isgreat.org/ PHPKetchup is a new project in planning stage. There isn't any code available for now (also seems intended commercial, not open source). It was announced as framework atop PHP-GTK. There is a conception document which explicitly lists the goal as designing a MVC framework.
However it seems like they take inspiration from CodeIgniter and mostly the common PHP framework structure. The focus seems not to lie on integrating PHP-GTK with the application logic, but mostly to provide a database interface as model and a thin Gtk interface for the View.
MVC Architecture:
We will design and implement Model-View-Controller (MVC) architecture for the PHP-GTK framework. SQLite will be used for Model. PHP-GTK functions and Glade files will be integrated in View after removal of HTML, CSS and Javascript. Controller will be modified accordingly to work with the newly created View.
So it might just be MVC in name and organization, but one of the diagrams mentions "PHP-GTK functions addition" and there are further hints of object-structured Gtk helpers.
I have been tasked with building a simple web based system for managing a list of vehicles.
I am interested to know whether there are any robust, clean PHP 5 frameworks / libraries that are specialized in doing this quickly.
They should be able to quickly build a skeleton web back-end to an arbitrary data structure with the basic functions:
Customizable list view
Customizable edit form
create/update/delete operations
Nice to haves:
Multi-user interface
ACL based rights system
Localization
Image / File upload built in
Wet dreams:
A skeleton CRUD API to manage items programmatically
A skeleton RSS feed to inform about new items
I am aware most big frameworks provide tools and helpers for this, but would prefer a standalone, light-weight solution that is easy to get into.
Alternatively, is there a great PHP application that you would recommend looking into to modify to suit my needs?
As far as building skeleton apps goes, nothing comes close to the Yii framework.
From the site:
MVC, DAO/ActiveRecord, I18N/L10N,
caching, jQuery-based AJAX support,
authentication and role-based access
control, scaffolding, input
validation, widgets, events, theming,
Web services, and so on. Written in
strict OOP, Yii is easy to use and is
extremely flexible and extensible.
It also includes CRUD code generation. Headed by the guy who did Prado.
If you don't want a big framework, you could check out phpactiverecord
I would recommend CakePHP
I've seen awesome demos of the instant blog in Rails and Django and Symfony.
Looking at Zend, Cake, Symfony, Symfony seems the most like Rails/Django. Check out the 10 minute (yeah, super sped up!) demo. It's pretty sweet:
http://www.symfony-project.org/screencast/cart
My experience tells me that there's no framework, lightweight or otherwise that you can easily do what you want quickly if you don't know it. So that's where the tutorials come in. You really need a nice ORM to avoid all that mess with the DB and or reinventing that with a CMS. So the best bet is to choose the one with the best docs, the best tutorial + screencast, in the language you know that gets you closest to your requirements by just changing the names of the variables. I know Django can do all that you're asking with Django 1.2, but with PHP 5 being the requirement, Symfony and it's ORM is my first suggestion.
Yii looks like something I'll be taking a look at right now! Yii-Haaw!
Here's Yii's screencast of blog making: http://www.yiiframework.com/screencast/blog/
Not bad so far! But it's quite a learning curve to get the blog working. Very similar to Rails.
The best i have seen around in years http://www.grocerycrud.com/ its for codeigniter
Sapphire has a lot of promise. I have used the CMS built on it - SilverStripe - for a few projects and it's very nice. But I haven't dug into the back-end too much.
From the website:
Our Object-Relational Mapper takes
care of your data. Define your data
model using our simple PHP5 syntax
and our ORM does the rest.
Tell
Sapphire about your data model, and
you get 3 interfaces for free. A
RESTful API, a SOAP API, and an admin
editing interface.
It's not exactly lightweight, but its core is ~1.3 MB but meets a lot of your "nice to haves"
There are several PHP frameworks that meet your requirements (basic requirements). You should use a framework that you are most familiar. If you do not familiar with any framework, I suggest you to use the CodeIgniter.
I've been looking for a drop-in admin panel like this too, so far I've 2:
AjaxCrud - http://ajaxcrud.com/
Peek from Code Canyon - http://bit.ly/toKKrB
Love to hear any other suggestions!
What is the difference between a PHP framework and a CMS? It just unclear to me what the difference is.
Thanks!
CMS = Content Management System.
Framework = Collection of tools, source code, methodology and idioms.
You can build a CMS with a PHP Framework, but you can't build a PHP Framework with a CMS.
Also, a CMS doesn't have to be built in PHP, but a PHP framework will be (most often).
A framework helps you create applications by providing solutions for common tasks, but a cms is an application. You can use a framework to create a cms.
There are also a few cms'es claimin to also be frameworks (or have framework capabilities):
Modx
Drupal
If you haved worked with one of the typical frameworks (CodeIgniter, CakePhp, and others), there are for sure quite different to work with a cms like Modx or Drupal, but they are flexible cms'es that are fearily easy to extend with new features!
A Framework is something designed to help programmers build applications, and possibly CMSes.
examples are CakePHP, CodeIgniter, and Kohana.
a CMS can be used by someone with no real programming expierience. examples are WordPress, Joomla, and Drupal.
A content management system is used to manage content. The content can be differentiated according to types, like custom post types for WordPress. You can create a CMS using a framework or code from scratch.
A framework can be thought of as collection of packages to speed up development (compared to coding from scratch).
Now, you mentioned that you want to make your own framework. You can create a framework from scratch, or use open source means, like Composer or Symfony components, to build your framework. Just remember that as a developer, you are responsible for making sure that any open source components you include in your system has been reviewed for security. You can do line-by-line review, which can be difficult (e.g. 5,000+ files on a lumen installation), or any other means based on established protocols of your organization or laws.
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 5 years ago.
Improve this question
I am a long time PHP user when it comes to web applications and am mostlz comfortable with it. However, I have a one semi-large project whose maintenance / extensibility has reached its end of a life cycle. I was weighing on different PHP frameworks (there were no when the project originated), since it is the way to go for this project, and I came to conclusion the ebst option would be to do it with Zend Framework.
Symfony seemed to complicated (I don't like setting up database model as that
CakePHP seemed murky
Igniter I liked at first, but then it seemed to me it is more like Zend with less features and no Zend behind it
Zend I like the system of that I can use only what I like and not being tied into a specific directory structure, and of course there is Zend behind it. Performance is what potentially bothers me
Now, after this little rationale behind choosing Zend, there are several things I see as a deal breaker when choosing a framework.
I haven't used ORM in the past because I am more than comfortable writing SQL directly, so I still need to be convinced to use ORM
Not too much abstraction going on from the guts
Flexible directory structure
As long as this project is going to be written anew, I just as might write it in Python/Django, since I am quite familiar with Python, but not with Django. So, I would like to know if there is someone that worked with both Zend Framework and Django frameworks and if can outline a few key point differences?
I must also say that this project is made as a standard site/admin dual project. That is, it is basically two sites in one. One is for frontend and users, other is for data administration in the backend. I must and will build backend on my own, some scaffolding methods would be cool, but full automatic scaffolding is as good as nothing in this case.
I am still quite not sure how one approaches building basically two applications within a directory structure of, what is supposed to be, one application. Do you just make two separate applications and rely on URL scheme from there on to separate them? www.example.com and all of the /* being one application and www.example.com/admin/* being a second application.
Sorry for the long question(s), but as you can see - everything is pretty much related to one problem - I need to start a project anew, it has already established database+data which I can remodel, but would like to keep that kind of work at minimum.
Ok, thank you everybody - looks like I'll try and implement this stuff with Zend, gives me most flexibility out of the package (I did tests with both), and we'll see how it goes.
Well Django is more fullstack framework than Zend. It's more similar to symfony than Zend.
Django can reverse engineer your database into ORM classes. and has a cli tool that help you do stuff ( admin and model generators, project skeleton generation etc.)
Zend is more of a component framework. it has its own MVC and ORM implementation but you need to write that stuff alone. Its approach is to use only stuff that you need without imposing some directory structure.
In your case Django will have some advantages because of its great admin generator module, and Django itself is pretty fast (faster than most PHP frameworks).
I'm personally using symfony with Zend framework for some stuff I need (Mail, OpenID, Lucene search), but have played a bit with Django and I like it.
Zend doesn't include a real ORM. It provides some helper classes but you are mostly on your own in modelling your database and writing your own SQL queries. So you would have full freedom there. As Deresh says, Zend is modularized so you can pick and choose the parts you want.
Personally I use Zend together with DB_DataObjects from PEAR as by ORM. It can auto-generate your skeleton code. It is a very simple solution for handling simple queries but I can always write custom SQL where necessary.
Regarding separation of the two admin and frontend I would suggest putting them on different domains, e.g.: admin.yoursite.com (backend) and www.yoursite.com (frontend). You can probably work it with having them both on the same URL but it is not really a use-case that is supported by Django or Zend.
I'm not so experienced with Django, but from what I've read about it, it doesn't seem to be what you're looking for (too much "abstraction from the guts").
Zend framework does not provide you with an ORM. It provides you with some tools that might aid in maintainability of your code (for example its much easier to do $user->save() on a Zend_Db_Table_Row object then to manually type in the equivalent SQL string).
If you're more comfortable doing SQL, that's totally cool and Zend digs that...just beware that there might run into some more maintenance issues down the rode. I would suggest going with a "named query" approach where you store you queries in an external resource and load them "on demand".
Zend has a very flexible directory structure...the recommended one only facilitates in making things a little easier.
You can easily pull of your admin section urls using modules and routing....its a very common use case in Zend.
Bottom line is, Zend is a "presentation framework" mostly. That's what it excels at. It gives you a clean way of organizing the presentation (the screens) that are shown to your users and aids in maintenance.
It doesn't do much for you from a data perspective. This is up to you, and is probably 90% of the work that needs to be done to become "maintainable".
The goal is that your business logic stuff and data access stuff should function within any "framework", and even without a web server! Otherwise you'll just move you unmaintainable mess from whatever you have to Zend.
Also, I wouldn't concern myself with performance...mosy things can fixed with a good caching strategy.
I can't compare between Zend and Django, but I can tell you it's entirely possible to have the Django "admin" application run on a different domain (virtual named server), and you don't need to duplicate any code. You just build your Django app as normal but put the admin app and url in a different virtual server that shares a common database server/cluster.
The Django admin app does have limitations, but it's very powerful for something that comes almost free.
Finally, when I first started Django I had a lot of disdain for ORM's in general but I accept them now as a useful tool in the toolbox.