OK, so I am trying to create a working Facade for the Resizer bundle for Laravel 3 (https://github.com/maikeldaloo/Resizer).
So far I have:
- Created a "Resizer.php" file with the code from the Reszier bundle and added the namespace BARThompson\Planesaleing;
- Created a "ResizerFacade.php" the contents of which are contained at the bottom of this post;
- Created a "ResizerServiceProvider.php", the contents of which are contained at the bottom of this post;
- These three files are all saved in: app\library\;
Added an autoloader to \app\config\app.php under the 'providers' => array which reads:
'BARThompson\Planesaleing\ResizerServiceProvider',
Added an alias to \app\config\app.php under the 'aliases' => array which reads:
'Resizer' => 'BARThompson\Planesaleing\Resizer',
Added the following directory to the autoload classmap in composer.json:
"app/library"
However, I can load the website successfully, but when I call Resizer::open, I get the following error:
Class 'BARThompson\Planesaleing\Config' not found
I am getting confused with namespaces. I havent used them anywhere else in my app, but as I followed a tutorial which used them (http://fideloper.com/create-facade-laravel-4) I have used them in my implementation without fulling understanding them.
Can anyone explain where I am going wrong?
ResizerFacade.php:
<?php
namespace BARThompson\Planesaleing\Facades;
use Illuminate\Support\Facades\Facade;
class Resizer extends Facade {
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor() { return 'resizer'; }
}
ResizerServiceProvicer.php:
<?php
namespace BARThompson\Planesaleing;
use Illuminate\Support\ServiceProvider;
class ResizerServiceProvider extends ServiceProvider {
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
// Register 'resizer' instance container to our UnderlyingClass object
$this->app['resizer'] = $this->app->share(function($app)
{
return new BARThompson\Planesaleing\Resizer;
});
}
}