Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Laravel News:
Installing Laravel in a Subfolder? Hide your .env file.
Mar 06, 2017 @ 15:42:59

On the Laravel News site they've posted an article with some reminders about installing Laravel in a subfolder including "hiding" your .env file.

If you are new to Laravel you might not be familiar with its directory structure and the reasons why it’s setup the way it is. If you look at the main repository it’s setup like this, and the documentation covers what each of these folders handles.

What is important here is the “public” folder. That is the ONLY directory you want to be exposed through the web. Everything else should be outside of your web root, this way people can’t access any of your important files through the browser.

He gives an example of an instance where a site was in a subfolder and, just by changing the URL, he was able to locate (and view!) the .env file complete with sensitive information. The rest of the post gives instructions on installing it in a subfolder, moving around a few folders and updating the front controller to change the autoload and bootstrap locations.

tagged: laravel subfolder sensitive data install tutorial

Link: https://laravel-news.com/subfolder-install

Michael Kimsal:
Is your code portable to subfolders?
Sep 02, 2014 @ 14:12:53

In a quick new post to his site Michael Kimsal asks an interesting question that some PHP developers don't think about in the course of their development: "Is your code portable to subfolders?.

Have been dealing with a couple of PHP projects recently which have been a far bigger pain in the backside than I anticipated, and both had some of the same stumbling blocks. In both cases, and in other projects I’ve seen, there’s a huge assumption that the code will be run from the root of a domain, and all url and routing management have this assumption baked in to everything they touch. What’s the answer?

Some projects just suggest making a new virtual host in the web server configuration and moving on, but this isn't always a real possibility for some projects. In some recent experience, he's found several of the major PHP frameworks assume this kind of setup. He mentions a Java framework, Spring, that allows for this kind of redirect and wonders why it's not that easy in something like Slim.

Maybe try grabbing your own code sometime and reinstalling it in a ‘non-traditional’ way, and see how many assumptions you’ve baked in are really necessary, vs just using defaults.
tagged: subfolder project portable framework

Link: http://michaelkimsal.com/blog/is-your-code-portable-to-subfolders/

Anna Filina's Blog:
Symfony - subfolders for partials
Feb 21, 2011 @ 17:14:32

Anna Filina has a new post to her site today about using subfolders for partials in Symfony applications and keeping them organized.

Symfony 1.2 - 1.4 expects all partials to follow this convention: templates/_partial.php. What happens when you need to organize your partials in subfolder? I tried a number of "Symfunky" avenues.

She tried a few ways - calling the helper with the include_partial method but it didn't resolve to the path she wanted. Next she tried a different path, but Symfony only interpreted it differently - and not the way she wanted. After a few more tries, she found a solution - using get_partial with a parameter that defined the subfolder to look in.

tagged: symfony framework tutorial partial views subfolder

Link:


Trending Topics: