Question: I was just going through the laravel documentation **[HERE](http://laravel.com/docs/master/providers)** and came across the following peice of code ::

```
<?php

namespace App\Providers;

use Riak\Connection;
use Illuminate\Support\ServiceProvider;

class RiakServiceProvider extends ServiceProvider
{
    /**
     * Register bindings in the container.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton('Riak\Contracts\Connection', function ($app) {
            return new Connection(config('riak'));
        });
    }
}

```

I am new to `use` in php , just learnt how it functions a few days ago , now does `use` , when used with a framework like laravel, where one class can be in a directory totally different from another , need to specify the directory structure too ? 

I.E. can directory structure impact the way `use` is used ?

Answer: 
The `use` statement in PHP (when used outside of a class) is used to import a class from another namespace. Namespaces and folder structure do not necessarily correspond, but it is generally pretty close.

The autoloader used by Laravel, and most other modern PHP applications is part of the [Composer](https://getcomposer.org/) package manager. Composer in turn supports multiple namespace standards, most notably [PSR-0](http://www.php-fig.org/psr/psr-0/) and its successor, [PSR-4](http://www.php-fig.org/psr/psr-4/).

In a [`composer.json`](https://getcomposer.org/doc/04-schema.md) file, you'll generally specify a namespace to autoload, and a base directory like so:

```
{
    "autoload": {
        "psr-4": {
            "My\\Namespace\\": "src"
        }
    }
}

```

Any classes in the `src/` directory should be in the `My\Namespace` directory. Classes in `src/Model` should have the namespace `My\Namespace\Model` and so on.
What a lot of PHP libraries use nowadays is called an **autoloader** which *may* mirror the directory structure, but does not necessarily have to.