-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Physical Application Structure #9
Comments
With thinking about separating concerns to keep the core api, backend and frontend as separate apps, I can envisage As I don't have as much experience as some, I have some questions:
|
Related, symphonycms/symphonycms/issues/1477 |
@designermonkey have a look at the docs. Should explain a lot of Laravel's package handling and file structure.
As long as they are registered on the autoloader you can run everything, e.g |
@designermonkey I had a brief look at how laravel's path configuration works and luckily they're not hardcoded. |
Then we have a problem using Laravel for this project, as from experience, many web hosts won't allow deployment of files outside of a shared hosting environment's web root. This is why Symphony is currently the way it is. |
This isn't laravel specific. If you wan't to, you can alter all system paths to your liking. It's more a security related issue to have executable code outside the webroot. I personally haven't had the bad luck to work on a shared host that doesn't allow you to configure the webroot location, but yes, this surely is a big concern. |
More generally, I don't think that Symphony should feel the need to accommodate every hosting setup out there. Shared hosting, yes. Crappy/unduly restrictive shared hosting? I'd say not. Rather than spend time on stuff like this, we could point out to people that they need to move to a host that does allow for files outside of webroot/public_html. However, I expect there are ways round it with Laravel 4 as there are with Laravel 3. |
You don't see the real problem: Even if your shared host allows to set the web root to a subfolder and thus actually have files "above" the web root, most people simply won't get it. Do you remember when you started with your first CMS? When I installed my first "system", I just wanted to:
If somebody would've said that I should put something outside of the web root, I would've given up, probably. So think of starters! |
Keeping the application folder outside of the webroot is best practice across the board with the majority of applications, frameworks, and even some CMS's. But it is just that—best practice rather than a requirement. I agree with David in that you can't cater for everyone but as long as it's the majority then it's acceptable. If hosting environments meet the PHP 5.4 requirement then chances are they're geared up enough to allow for items outside of the public_html/ directory. I've worked with a few shared hosting environments and I've not come across an instance yet where I've not been able to place files and folders outside the public directory. Maybe it's better to go on the presumption it's possible for the time being but keep an open list of any hosting environments which crop up which don't provide that level of access and determine if it will actually be a problem or not. Don't forget that again we're looking forward with the likes of PaaS and cloud hosting are really setting the new direction. In a year's time or more the hosting landscape will have shifted again so it's worth noting where things are heading. |
@michael-e Yes I guess it does depend on the target market considerations and keeping things simple. Does this have to be a requirement or can it not be kept as a best practice? I know in EE this is highly recommended as a best practice (as with all apps etc) but it's kept in the "Post Installation Best Practices" section after performing the install. I've seen quite a number of setups and the vast majority follow this practice and I've not heard anyone so far having problems either keeping it in the web root or moving it above web root for those that understand why and want a bit more security. That would certainly cover all bases. |
Agreed. |
I'd be happy if both bases were covered, but my opinion is that it shouldn't place extra burden on Symphony's developers and the project as a whole.
That's not a problem to solve by catering to bad practice. It's a problem to solve with good documentation and education. |
I'm all with a "Easy First" approach but you have to draw the line somewhere, especially when it comes to security related decisions. I fully agree with @DavidOliver here. and I don't think that this is a real problem at all but a educational issue you have to get used to. Remember the first time you stuck with the W3c Boxmodel implementation? But you're still using CSS, don't you. And that's by far more complicated than having two separated directories :). Apart from that, having the obstacle of dealing with xslt as a starter,
really seems to be a bit of a lousy argument. |
I already have this running with my adjusted layout, and I'm toying with a couple more ideas. I'm sorry to say that we need to cater for the easiest option, irrespective of whether it is industry best practice. Without moving the discussion off topic, we have a great problem with community uptake of our product, and we have a great opportunity to break that cycle here, so lets not put any obstacles in our way from the offset. If it turns out we can get feedback on the use of our product, and our users have the opportunity more often than not to change the root, then we should re-address it then, as for now, I really think we should try the all in one folder approach that we currently have. As Ian states, we can opt to follow suit of EE and advise on how to adjust the structure after the fact. Anyhoo, The main question here is to see how we separate the aspects of our app, the core, the admin, and the frontend. |
??? No comment. |
Why this can not be optional? Edit: I'm a bit delayed on this comment. Now that I read this:
|
I agree with John; it's got to be optional. Mind you I'd always go for the more secure option where possible; however simple install = potentially higher user base. Just throwing this in; if one had to use this two-folder structure how would it impact users who are currently using git to deploy? Two separate git or would it also work with sub modules? |
I like the idea of a "Security/Best Practices" article/documentation, as there are a lot more things that can be made in this way. Like file permissions, event filters, htaccess configurations, system folder placement, etc. But this is another subject... |
Whatever we do, it would always be one package that we release.
Already working on it ;o) (@designermonkey is a busy boy). |
Documentation in general I mean. |
I still don't fully understand the the separated app directory != easy install thing, but that's more a personal problem I guess. Keep in mind that with the one folder concept we have to shut down public access to all files and folders except of
|
@designermonkey I was playing around with the directory structure you proposed. The only issue I encountered so far is the config path being hardcoded to the application path. If this is a big concern we might have to overload I figure the next step is to replace laravel's configuration with the xml config. So, we maybe should discuss the structure of a config xsd schema first? |
@iwyg I've jigged it around a little too myself. I'll fork the repo and get the code in there on my account and we can start to look at it. This is all still high level stuff, and I still want us to focus on definition first, I've just been doing this while having some personal down time and a holiday. I've got some ideas for a schema already, bearing in mind we will be loading only Symphony related config with xml, the app config will remain as such, but we will need to define the difference as well. |
I don’t know if it has already been discussed, nor if this is the right place to post this, but did you consider to directly use components of Symfony (the PHP framework), instead of Laravel? Symfony is decoupled in small (and very high-quality) components, and Laravel reuses a lot of them. Maybe it would be a better solution, there is no imposed structure with these components, and Symphony Next would not be restricted by the requirements of an “end-user framework” like Laravel. Plus, the Symphony CMS would be powered by the Symfony framework :-) |
I have to say, I have thought this. |
If Symphony CMS is not going to follow Laravel's conventions and file structure, perhaps Symfony is a better fit. And as has already been pointed out in other issues, Symfony can use XML for configuration already. |
that being said, the question is which ORM we are going to pick. Laravel's Eloquent? Doctrine? |
The two frameworks differ in which layer of the software cake they operate. Laravel is one level up providing the syntactic sugar to make things a little sweeter whilst Symfony provides a few of the ingredients. Symfony is more of a full-stack framework (modularised of course) whilst Laravel just aims to provide a little opinion and set some sensible defaults and provide some common utilities from the get go. It's designed to make things easier to work with on a daily basis in a similar way Rails did to Ruby. Laravel is popular and lowers the barrier to entry as a result of this and that is a big selling point if the aim is also to increase adoption whilst making it easier for the core developers to work with on a daily basis Laravel is actually more on a level with something like Silex (also from SensioLabs) so that again could be another option as are other micro-frameworks like Slim and the Fat Free Framework. Generally though I think having Laravel in the mix is one of the key ingredients as it provides the glue and an easy interface to work with on a daily basis for the core team and for potentially interested newcomers. It handles things with elegance and style and riding on the back of the Laravel wave can only be a bonus with the likes of features, documentation and marketing (to an extent) all taken care of. I think it was mentioned earlier in this thread or another but this is a good discussion on Laravel vs Symfony2 with Taylor summing up a few key benefactors nicely: http://www.reddit.com/r/PHP/comments/1bdln1/symfony2_vs_laravel |
Eloquent would get my vote. That's one of Laravel's strongest points and surely one of the best ORM's available. |
I think we're probably better off just using the actual framework. It'll give us a little more freedom and will save us having to 'hack' the Laravel defaults for our purposes. We'll build Next using the Laravel Framework, not the actual Laravel end product. Is that what you imagined too @iwyg @nils-werner? |
I am happy with that, as my biggest gut wrenching concern here is that I do not want us to just be a package to install on Laravel framework. That IMO would kill us as a separate community. |
I can appreciate this concern. Lets not cripple Laravel potential though. |
How would we be crippling laravel's potential if we use the framework vs laravel's packaged app? |
Sorry, wasn't referring to framework vs packaging. I just don't want to hack the structure and make it difficult to build upon using Laravel/composer package conventions. |
Interesting...and slightly confusing... It may be a dumb question but what's the difference? And where does Illuminate fit into it all? The Laravel wiki makes mention of individual components coming from Illuminate but not on any difference between Laravel repos:
And this article touches on the difference between the repos but says laravel/framework pulls in all it's dependencies from laravel/laravel (develop branch) anyway:
So what are the differences between laravel/laravel and laravel/framework and how do they fit in with Illuminate components? |
laravel/laravel is just the application bootstrapper if you want to call it so. laravel/framework is a repository that holds all illuminate components. |
oh, and illumiate components started as individual packages but they're now just a subtree split of laravel/framework |
OK that clears it up a little. There really doesn't seem to be much information around to clearly explain the differences. So the proposal is to use the laravel/framework repo and not try to map up to the laravel/laravel directory structure? Just call in the illuminate (or other sourced) components via composer in a less opinionated way? |
I think that's the point. |
Ok gotcha. Just checking. :) |
Maybe we should just wait until Laravel 4 is officially released later this month and the updated Laravel website and documentation sheds some light on those kind of things. |
I may be a bit late to this discussion but I had to step back a little from this highly opinionated topic and have a deeper look into Laravel (app and framework, wich is called Illuminate by the way) myself. First I did the usual things, creating a few components and writing a simple member-login enabled system (so easy, and everything is builtin already!). Then I installed a few packages. And this was what blew me away: You basically simply add
to So, to try out writing a package myself I went on to create a simple scaffolding tool. At that time I wanted to change as few Laravel conventions as possible so I implemented it to basically consume any All this trying out made me think about how to possibly de-couple some Symphony components myself. We could for example ship a login-system (wich relies on Sentry or any other established login system), a scaffolding system and a schema-builder (the latter two automatically installing the login system via composer). And then maybe a meta-package that wraps it all up to get the entire "Symphony experience". This means you can remove unneeded (and potentially unsafe) components like a schema builder from your production environment and have only the important stuff for your editors remain in the system. Or, more importantly, give anybody the ability to say:
This feature would penetrate the entire entire entire entire entire entire Laravel ecosystem in one big swoop. Everybody from our community and everybody from theirs (at least ten times the size and growth) would instantly become a potential user of Symphony Next. Everybody writing some Laravel specific packages would automatically write them for Symphony, too. These thoughts after the few weeks of tinkering convinced me as to how I want Symphony Next to be: It must be one of the may packages that can be installed just like any other package; sitting side by side with everybody else in what the default Laravel installation. Everything we know from Symphony is there in Laravel (the application), it just has a different name. The workflows are exactly the same, too. There is no point in rewriting everything just to have our dear old terminology back. |
I find this Laravel / Illuminate thing still a bit confusing. There's no mention of Illuminate on Laravel's website except as a namespace in the API docs.
Anywhere else, it's just Laravel framework, so we should use this as described in the docs, I guess.
Makes sense to me. One of the many points of conventions and using a framework is that other developers familiar with that framework could easily understand and contribute to your project without re-learning everything. Sure, we could just use Laravel to build our application and stay away from (instantly repel) the Laravel community. But if we want to gain more traction and lure other developers in, that's not the way to go. |
Think of Laravel being the root folder of your Symphony installation, Illuminate being the Having them separated enables you to update one without touching the other. |
YES and YES . When I originally posted the Laravel thread on the forums this is exactly what I envisioned. I believe it to be obtainable as a project, highly flexible, and forward thinking. |
Right, I think there's a massive communication issue here as to what Symphony is, and what were wanting to achieve here. What you're all asking for is a framework with a Symphony style admin on top, where the Laravel We are catering to users who don't know PHP. We are catering to users who want a system that they can use to easily create a website or application, by either developing xslt templates for a frontend, or another templating language. We re building a product. A product sits on top of a framework and leverages the best of the framework. We are not building an extension of a framework which you all seem to be proposing. Am I the only one who sees this from a viewpoint of a non developer? How is a non developer going to be able to create a site with what you are all proposing? Designers can learn XSLT easily, as they should already be familiar with the XML style markup of HTML, and the declarative style from using CSS. They would however struggle to learn PHP, I know I did. Doing what you all want will instantly alienate most of our community, myself included, and that is a big problem. |
I think the point of this discussion to figure out what exactly we are trying to achieve. None of the solutions proposed here should be simply ruled out because "we're trying to achieve something else". Same goes for "we're building a product, not an extension". Argumenting with "that's not what Symphony is" leaves you limited to what Symphony currently is not to what it could become. Yes, my proposal does not fit with the definition of Symphony 2; but does that make it any less valid? Look at it from this side: Why shouldn't we be able to create a suite of tools that creates generic Laravel code like models, Controllers etc.? Symphony currently does exactly the same: It creates Symphony PHP code. |
It's possible to build a prototype with both developer and non-developer ways installation? |
I don't see a communication issue at all. There are two possible ways to recreate the Symphony experience that both have advantages and disadvantages. The question is:
Workflows, UX and UI are in out hand in both cases. |
I agree. Maybe we should start a new Wiki page where everybody can chime in on what the pros and cons are? You know, to get a better picture of what we're talking about. |
@designermonkey @nils-werner I think from what I read through the evolving discussions; symphony is far more about the UI & Symphony Experience, when actually making use of the CMS. I understand that there are pro's & con's for each way we could go about it. What I'm sure of is that there is not a single way to go about it. I'm a php developer; and having to code some php doesn't bother me that much; however I fully understand that for new-comers it would be easier to have a zip file which lets you start working straight away. As long as the latter is possible without requiring any php I'm not too sure what @designermonkey's concerns are. I also think that a reason for Symphony to move on to Next is to make it more powerful, attractive and usable. |
I don't see why you wouldn't be able to have the best of both worlds here. Would a zipball containing a skeleton with an install script to fire off composer and set up migrations - similar to the web install Symphony has now - really be so complex to do? Symphony could still be a package for Laravel, but that doesn't prevent anyone from bundling them together with an easy install option. |
Exactly what I was thinking. Are these two approaches really that exclusive to each other? Why can't we use the framework's conventions and ways of doing things (so developers could still use Symphony as a starting point for custom applications or easily write extensions with their knowledge from working with the framework) while also creating a self-contained product that non-developers can easily use? What we're currently doing (offering an additional way to developers for installing the system and extensions directly via git) isn't that different, in my opinion. |
With regard to installation, a good couple of recent examples include Ghost and Wardrobe CMS. Ghost—I'm sure most people are aware of—is a Node.js based publishing system which started as a hugely successful kickstarter campaign. Installing Ghost on a Mac requires the user to open the terminal, install Node (+npm), add to the global PATH variable, and install via npm. On a Linux server this is trickier still. Wardrobe CMS is a CMS/publishing system built on Laravel which is designed to be small and simple. Installation of Wardrobe requires Composer to be installed and the Wardrobe itself is installed from the command-line with permissions and database adjustments in the config files. It then just follows through an on-screen installer much like Symphony. It's worth nothing that the installation process or requirements of Ghost have certainly not stunted it's growth, outreach, or popularity. It's the publishing platform of the moment despite that. Wardrobe, although not as popular as Ghost is a demonstration of a CMS built in Laravel and fairly easily deployed. Although a few years ago people wanted a zip install and upload via FTP client I don't think it's so much of a barrier today as it's more the way of things. I don't think a It's also possible to create an installer to make things easier as Bitnami and others have done for Ghost. Another potentially useful addition to Laravel will be the |
Using nodejs for local development is far easier than setting up Apache and PHP, but there are far fewer nodejs hosting options (I'm looking for the everything included webspace package, with domain and email for a few bucks). The question is, how will it look in 2, 3 or 4 years? I think javascript on the server side will be the next big thing ;) |
Exactly what people thought about Rails a few years ago... |
So? Rails is still there. I guess there's no such thing as "the next big thing". You choose what fits best (or what's most expensive, well, depends on the client:)). |
Node.js and JS on the server-side is definitely the future but yes, as @iwyg mentioned, it's horses for courses. The main point I was making however was that in terms of installation concerns raised in this thread. It's not uncommon to require some usage of the CLI or have the odd dependency. It's mainly just the changing of the tide across the board. Ruby and Rails are probably the worst for that. Gems, passenger, rake operations etc. Ruby apps are most commonly are not the smoothest to install but it hasn't stunted the growth or popularity of the apps built on them. PHP is an interpreted language which already has the biggest advantage in pretty much being able to drop anywhere and have it work. The odd directory move isn't too much to ask in comparison with other applications built in different languages and frameworks. So that shouldn't be an issue which slows down development. One way or another it can be solved but it's a bridge that can be crossed when we get there.
I wouldn't say it has to be an exclusive choice of either. We just build it as a standalone app which follows a common convention. It's a good idea to keep the domain specific logic in a So when looking at John's original directory structure if we keep the Nothing's set in stone but it's not worth spending too much time on the odd directory name or two. Getting started is more important. |
One of the great things about Symphony is the ease that comes with installation; A website owner can just drop the package into their root http folder and hit up
/install
in their browser and get on with it.Laravel works slightly differently in that the root http folder is part of the package, and there are lots of files surrounding that folder. This will make it more difficult for a website owner to install the package, as they will have to allow for this structure. We already know that a large number of our community use shared style hosting, and we cannot afford to just assume that all of these users can manipulate their hosting environment to allow a package like Laravel to be installed. It's ok for us developers, but what about the non-developers?
We will have to make some modifications to allow our product to be used by the same current base of users which will mean that we can't just create packages called 'Symphony Whatever' and allow them to be installed on Laravel. We are building our unique product based on a framework, so our folder hierarchy will be unique to us too.
I really like our current folder hierarchy (at a base level, not inside the
/symphony
folder) and it has lent itself to our terminology also, which we should try and keep intact too. I would like to see us mimic that as closely as possible with the obvious requirements that using Composer adds.I've got a default Laravel working with the following structure, and so would like to propose it as our structure:
The text was updated successfully, but these errors were encountered: