Categories
Et Cetera

Laravel 4 – Get Path to App, Public, Storage and Base Install Directories

[php]
<?php
/**
* Path to the ‘app’ folder
*/
echo app_path();
/**
* Path to the project’s root folder
*/
echo base_path();
/**
* Path to the ‘public’ folder
*/
echo public_path();
/**
* Path to the ‘app/storage’ folder
*/
echo storage_path();
?>
[/php]

36 replies on “Laravel 4 – Get Path to App, Public, Storage and Base Install Directories”

very usefull . thanks!
But I have a question why are you using the stinky wp ? why not make your own blog with laravel?

Um because, setting up a WordPress blog = 15 mins. Coding your own blog with Laravel, as great as a framework as it is, takes more than 15 minutes. Why would he re-invent the wheel. If he needs a blogging platform, use a tried tested and true piece of software. Many people, including rails developers, write about their work on this open source PHP project. Chances are this guy already has a job, he doesn’t need to make more work for himself.

Work smarter, not harder.

guys.. please.. wordpress sucks. does not matter if we got ten million themes, neither set up & install time.. wordpress is not versioned, not secure and ugly coded

Again and again, I hear developers complain about ugly code. Every new technology brings advancements. Laravel is awesome today. That doesn’t make it the ultimate framework for all the future. Something better will come up and you will start saying Laravel is poor. Just like how developers put CodeIgniter on a pedestal and then kicked it off when Laravel came. Developers need to take a step back and think of solutions and not code. WordPress works for the end user. WordPress is in fact awesome for the end user (client and their customers). So, why jump ship when everyone is happy and making money? Versioning and ugly code make sense to you as a developer but no sense to a client.

WordPress works for the end user. So what? still been crap :) the core is crap. Sure, someday laravel will be horrible, I don’t think so. Laravel is a cutting edge framework. My issue with WP is this : I have 20 new clients since 2013 who use wordpress and hate it. Because someone install it for them with out zero idea of security and this my friend… this is the biggest issue.. Anyone can install it and after two or three months of traffic… a cracker will see the wp and his pluggins and will destroy it. This is my issue with WordPress.
Cheers.

Nicolas, I agree with you that WordPress has people seduced. I’ve lost (gave up?) clients because they chose to use WordPress and I don’t want to invest my time into supporting it when I know there are better options. I also offer WordPress hosting to some clients and offer free (technical) support very occasionally (rarely!) just to keep them happy because they are awesome people. We need to remember that not everybody sees the world through our eyes… the world looks very different to different people. And if some people are happy with WordPress, there’s just nothing you can see (nor need to) to change their mind. It’s not worth the stress. You are happy with Laravel, so put your energy into the clients that appreciate your expertise and professional guidance. Don’t sweat the rest. It took me a _long_ time to come to terms with that, but I finally did, and life is much happier.

I wrote a minimal CMS with Laravel, just a CRUD with file upload and a WYSIWYG.. And also manages cache, is faster as cheetah =P and I use startbootstrap.com/template-overviews/sb-admin instead of “wp-admin”
All my clients are happy and don’t have security issues in my server :)

We need to remember that not everybody sees the world through our eyes. like it thisone too

I also agree that the world has become filled with “WordPress Experts” that are nothing more than click-happy puppets. That’s the downside of dumbified frameworks like WordPress… they make it _too_ easy and suddenly the overall quality of work is lost on the client. People see fancy themes and flashing animations and don’t realize that someone forgot to lock the back door properly. A month later and their website is secretly sending out spam to thousands of unsuspecting recipients. That’s not WordPress’s fault per-se, but the result of it hiding too much of the complexity.

I agree with everything! And I love the “click-happy puppets” phrase =P
People should know more about php, mysql before install a wp… and of course.. read the f***ing plugins code before install them :)

sure, for simple blog & bussiness card website WP is set up in 5 minutes and forget thing
but as every single CMS, when you need to add some feature you have to
a) pray that at least plugin api allows it, and if not, give up

b) not give up and throw away 1-click updates, including critical fixes
c) try to keep diff files and port your changes to future releases
for simple thing as personal blog creating it in laravel may even take less time than adding that-single-strange-feature-you-REALLY-want, and maintenancing it in future
everything depends on your needs

I need to bookmark this page, I keep having to google for “laravel4 path” and your number one… just wish I could remember the functions myself haha :)

all function are working on localhost, but gives error on remote server. Call to undefined function app_path()

public_path() not wordk for me (local environment works, production return empty string). All other functions working (app, base and storage).

I searched on google but not find a solution.

somebody can help me?

Anybody guide me how can i change the temp path in image upload time in laravel define in destiantion path in public folder

Comments are closed.