app icon indicating copy to clipboard operation
app copied to clipboard

RFC: 6.x: Use public/ instead of webroot/

Open dereuromark opened this issue 4 months ago • 8 comments

I think with v6 we should finally fix this up to be consistent with all other frameworks and the intuitive understanding of

  • whats actually "public" from the outside, accessible directly
  • and whats "under the hood"

This would make CakePHP compatible with https://github.com/php-pds/skeleton

Symfony, Laravel and the other major PHP frameworks all use this for years, and it also makes the transition from them to Cake easier, as well as provide less hacks needed for dev tools (e.g. ddev needs to customize this internally to fit Cake).

dereuromark avatar Aug 21 '25 11:08 dereuromark

One thing I always do wrong is where I put user generated content. Could be a js, pdf, xls, etc.

I tend to put it at webroot/generated/idl, webroot/generated/xls, etc.

but then other places i put it in generated at the same level as webroot. There should kinda be a default as sometimes I end up making the entire webroot read-write when in theory I should only make a generated dir writable and everything else read-only to the webserver.

More correctness about "webroot" would be helpful.

umer936 avatar Aug 21 '25 18:08 umer936

Is the generated content supposed to be internal or external (= accessible via URL)?

  • external: webroot/files/... for example
  • internal: resources/...

dereuromark avatar Aug 21 '25 18:08 dereuromark

I'm on-board with this change :+1:

markstory avatar Sep 01 '25 02:09 markstory

Thought about this a bit more, what happens with plugins, and the core command line tools for moving webroot files around? Do those start to support both public and webroot?

markstory avatar Sep 01 '25 02:09 markstory

Thats why 6.x It probably should be a hard cut.

dereuromark avatar Sep 01 '25 06:09 dereuromark

Thought about this a bit more, what happens with plugins, and the core command line tools for moving webroot files around? Do those start to support both public and webroot?

I was wondering if for plugins we should use the folder name assets, since they are made publicly accessible through the AssetMiddleware (or symlinking under app's webroot/public folder).

ADmad avatar Sep 19 '25 12:09 ADmad

It probably should be a hard cut.

Meaning 6.x won't be backwards compatible with the plugins that use webroot naming?

mehov avatar Nov 18 '25 17:11 mehov

Yes it will per App i think to some extend. Because this is a skeleton and config change.

dereuromark avatar Nov 18 '25 17:11 dereuromark