mercredi 9 mars 2016

Adding a new folder as namespace into Laravel application

I am currently building a Laravel API box and am having trouble getting my IDE to recognise a folder's namespace in my editor.

I have added a new folder into the following location:

/app/Http/

The new folder is called 'Transformers' and I am going to use it to hold JSON view structures in PHP to be called when a JSON response is being generated.

I have added the new folder but when I go to create a file in that folder called 'ProductTransformer.php' and create the namespace, my Transformer folder is not being seen as a valid namespace. Is there somewhere else where this new namespace has to be registered?

Here is the file I am attempting to create in that folder location:

<?php

namespace \App\Http\Transformers;
class ProductTransformer
{

 }

The 'Transformers' part of the above namespace is not being recognised.

Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire