yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.24k stars 6.91k forks source link

Skeleton application: a fully fledged skeleton suitable for big applications #40

Closed qiangxue closed 8 years ago

qiangxue commented 11 years ago

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:

frontend

backstage

console

andersonamuller commented 11 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.

schmunk42 commented 11 years ago

My proposal: https://github.com/phundament/app - the directory structure is totally flexible.

Ragazzo commented 11 years ago

Yii-boilerplate maybe, no?

Pulgafree commented 11 years ago

I am with @schmunk42 proposal

waitekk commented 11 years ago

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.

schmunk42 commented 11 years ago

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.

resurtm commented 11 years ago

Voting for architecture and structure which is utilized by YiiBoilerplate and recommended in Qiang's article.

samdark commented 11 years ago

I'll create a pull request for it.

qiangxue commented 11 years ago

@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!

schmunk42 commented 11 years ago

Proposals:

resurtm commented 11 years ago

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:

  1. Shared/application specific rules set with context: https://github.com/resurtm/yii2-acme/blob/master/common/config/main.php#L68-L86
  2. Custom URL rule class with context property: https://github.com/resurtm/yii2-acme/blob/master/common/components/UrlRule.php
  3. This is how i use shared 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-L142
schmunk42 commented 11 years ago

I have a general question. Why do you separate frontend & backend at all?

samdark commented 11 years ago

Because on some projects it is easier to work with such structure:

schmunk42 commented 11 years ago

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

samdark commented 11 years ago

When extra security needed we may deploy backend to the server not accessible from internet at all.

Ragazzo commented 11 years ago

hm, what about this one? https://github.com/tonydspaniard/yiinitializr-advanced I think at the moment it is most powerful, no?

samdark commented 11 years ago

Yes, that's very close.

tonydspaniard commented 11 years ago

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).

samdark commented 11 years ago

397

schmunk42 commented 11 years ago

References: Backstage layout: Examples from Yii Forum Discussion Login/signup via Facebook (extension?): Best rated extensions from Yii1 eoauth, hoauth

egorio commented 11 years ago

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.

schmunk42 commented 11 years ago

@egorio I thought about the same. But does the extended license cover this?

egorio commented 11 years ago

@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.

samdark commented 10 years ago

Spent some time drawing a possible layout for backend of advanced app:

yii-admin

Thoughts?

schmunk42 commented 10 years ago

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

andersonamuller commented 10 years ago

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:

http://startbootstrap.com/sb-admin

sb-admin

schmunk42 commented 10 years ago

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.

samdark commented 10 years ago

@schmunk42 debug is definitely not for production.

Registering icons and menu items is planned.

@andersonamuller quite similar. Mine was insprired by Wordpress admin panel.

Ragazzo commented 10 years ago

@samdark you designed debug panel interface or for what is it?))

angelcoding commented 10 years ago

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

kmindi commented 10 years ago

@angelcoding that looks pretty good ;)

rubenheymans commented 10 years ago

@angelcoding what about this one http://startbootstrap.com/templates/sb-admin-v2/

kmindi commented 10 years ago

http://almsaeedstudio.com/AdminLTE/index.html (https://github.com/almasaeed2010/AdminLTE)

schmunk42 commented 9 years ago

Just adding this one for reference https://github.com/dmstr/yii2-adminlte-asset

tsvetkovpro commented 8 years ago

Что с этим вопросом ? никак не пойму почему не закрывают баг?

samdark commented 8 years ago

It's more or less done. Closing since it's a meta-issue.