0

I am using laravel 4.2. I am following this basic tutorial on how to build Laravel Commands. I want to know where laravel is defining or registering the file paths to. For e.g.

use Illuminate\Console\Command;

is actually refering to the path below

vendor\laravel\framework\src\Illuminate\Console\Command.php

I am new to laravel, If you could point me to the right direction it would greatly help me.

2
  • Hey Kris, are you asking how laravel knows the base path for the directory? e.g /vendor/laravel/framework/src/RestOfPath Commented Dec 14, 2015 at 7:56
  • @Cptmaxon yeah, I am looking how laravel knows the base path. Do you have any idea that will help me? thanks for asking Commented Dec 14, 2015 at 8:39

2 Answers 2

1

there are two files you need to look at under app/config one is start.php this register the basic path for the laravel source files the base path . "/vendor/laravel/framework/src" .

the second one is app.php which provide an aliases array that correspond to the source classes and files.

for instance if you want to know where the class eloquent that your models are extending is at, you need to go to app.php see that Eloquent alias points toward 'Illuminate\Database\Eloquent\Model' and concat the path from start.php so it will be at \web\yourproject\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php

config.php holds the rest of the mapping.

Sign up to request clarification or add additional context in comments.

1 Comment

there is a bit of information that help me a little in app.php but the 'Illuminate\Console' directory is not there. Where could that be?
0

So I studied how it locates the file it was using. Then I found out it is using a namespace. The book called CODE BRIGHT by Dayle Rees greatly helped me in understanding how namespacing works. You can scroll down under the section called THE PRIMERS where Dayle describes how it functions. It is easy to understand! Give it a try.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.