Closed qiangxue closed 8 years ago
My initial proposal: https://github.com/andersonamuller/php-app-structure-proposal I didn't have the time to documented it yet, but I hope it will raise some discussion/comments. Some files like www/index.php, app/test-drive/bootstrap.php also have some prove test.
My proposal: https://github.com/phundament/app - the directory structure is totally flexible.
Yii-boilerplate maybe, no?
I am with @schmunk42 proposal
Agree with @schmunk42, this slightly reminds of SF2 structure, no app code in document root, only entry point script + published assets; vendor libs stored separately.
Just to note that: some things are different from Symfony2.
AFAIK (just have been to a SF2 Session) in SF2 the app
folder is more like your application configuration, while in src
are the classes of your application.
In Phundament your application is in app
, which is equivalent to protected
in the WebApp Skeleton. In src
there's only the ComposerCallback class, which hooks yiic commands into the composer process.
The locations can be changed and are fully customizable via composer.json
and config/main.php
.
Voting for architecture and structure which is utilized by YiiBoilerplate and recommended in Qiang's article.
I'll create a pull request for it.
@samdark It would be great if you could describe the dir structure here first before you start implementation.
I'm thinking we should rename "bootstrap" to "simple", and this to "advanced". For "simple", perhaps we should revert back to the "protected" folder structure since that is the easiest way for shared hosting users.
We should also think about the features to be provided by "advanced". Here are my suggestions. Your suggestions are welcome!
Proposals:
I'd like to see (and i almost sure everyone else would use it) shared/common URL manager rules feature. I always came across tasks when i have to generate URLs to the frontend
application controllers from console
or backend
codebase, but default URL manager implementation doesn't allows this (rules from different applications clashes).
Example of how i'm solving it now:
frontend
rules to generate blog post link (no matter what application uses Post
model at certain time): https://github.com/resurtm/yii2-acme/blob/master/common/models/Post.php#L141-L142I have a general question. Why do you separate frontend & backend at all?
Because on some projects it is easier to work with such structure:
Do you split/distribute the application across servers?
I'd say the access and security should be handled by the application, eg. gii is part of the core in Yii 1 and also uses IP filters. Backend and frontend layout (theme) should be handled easily in Yii2. Personally, I think this layout is caused by some limitations in Yii 1.
Anyway, there are three commonly used layouts (using yiinitializer terms):
I think the most important thing is to keep the app templates really slim and have the extensions working in every setup. Related Issue: https://github.com/yiisoft/yii2/issues/389
When extra security needed we may deploy backend to the server not accessible from internet at all.
hm, what about this one? https://github.com/tonydspaniard/yiinitializr-advanced I think at the moment it is most powerful, no?
Yes, that's very close.
For various types of bootstraps, please see Yiinitializer removed lots of garbish from YiiBoilerplate (far too many configurations) and took lots of ideas and conceptions from other Yii project structures available (even Phundament - thanks to Tobias).
References: Backstage layout: Examples from Yii Forum Discussion Login/signup via Facebook (extension?): Best rated extensions from Yii1 eoauth, hoauth
More ideas about design look at https://wrapbootstrap.com/themes/admin.
Some of that themes with extended license are not expensive (for example - https://wrapbootstrap.com/theme/metro-admin-theme-metro-king-WB0GRG7H2).
I can take part in the purchase. Bonus - more widgets to the backend app.
@egorio I thought about the same. But does the extended license cover this?
@schmunk42 I do not know much about licenses, but about BSD nothing written :( - https://wrapbootstrap.com/help/licenses. I think, if we take this way, we can negotiate with the owner.
Spent some time drawing a possible layout for backend of advanced app:
Thoughts?
I though about a mechanism for registering navigation items by extension in the left menu bar. Eg. user or rights extensions could register their own submenu or toolbar icon in the backend.
Furthermore I'd like to see the the debug-toolbar enhanced, so that it can also be used for switching between frontend and backend, but also to edit the current page in the frontend for example. I think with a slight update to the filter/access options, this should be pretty easy. See also https://github.com/yiisoft/yii2/issues/838
About the layout, it's pretty similar to this free template designed for Bootstrap 3, maybe it can be usefull and save some of your time:
The markup of the backend views has to follow a specific form, like:
<h1>Module Name<small>View</small></h1>
<div class="breadcrumbs">
... breadcrumb-widget, data handled by controller...
</div>
<div class="content">
... rows and spans, whatever you like ...
</div>
This should be very close to the Bootstrap 3 classes, if not identical. (Yes, I think we have to stick with bootstrap here ;)) I haven't looked into the above, but many admin themes defined a lot of additional classes to create the style for the boxes, etc...
If Bootstrap 3 is extended, then we have to provide the theme, along with a nice mechanism to apply it for certain controllers.
@schmunk42 debug is definitely not for production.
Registering icons and menu items is planned.
@andersonamuller quite similar. Mine was insprired by Wordpress admin panel.
@samdark you designed debug panel interface or for what is it?))
Just in case it's still relevant/useful there's a very good MIT licensed Bootstrap admin template I found here.. https://github.com/onokumus/Bootstrap-Admin-Template demo - http://demo.onokumus.com/metis/dashboard.html
@angelcoding that looks pretty good ;)
@angelcoding what about this one http://startbootstrap.com/templates/sb-admin-v2/
Just adding this one for reference https://github.com/dmstr/yii2-adminlte-asset
Что с этим вопросом ? никак не пойму почему не закрывают баг?
It's more or less done. Closing since it's a meta-issue.
The skeleton should contain multi-tier directory structure (something similar to http://www.yiiframework.com/wiki/155/the-directory-structure-of-the-yii-project-site).
It should contain tools supporting environment switching, deployment, etc.
It should contain a ready-to-use backend, and a nearly empty frontend.
TODO:
backstage
→backend
frontend
backstage
console