Skip to content

Instantly share code, notes, and snippets.

@rtablada
Created July 15, 2013 21:11
Show Gist options
  • Save rtablada/6003537 to your computer and use it in GitHub Desktop.
Save rtablada/6003537 to your computer and use it in GitHub Desktop.
<?php
// app/config/app.php
return array(
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => true,
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => 'http://localhost',
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => '6Gyb5xJvdgjwU0Cl9o8zuTjEBGDt8vob',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => array(
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
'Illuminate\Cache\CacheServiceProvider',
'Illuminate\Foundation\Providers\CommandCreatorServiceProvider',
'Illuminate\Session\CommandsServiceProvider',
'Illuminate\Foundation\Providers\ComposerServiceProvider',
'Illuminate\Routing\ControllerServiceProvider',
'Illuminate\Cookie\CookieServiceProvider',
'Illuminate\Database\DatabaseServiceProvider',
'Illuminate\Encryption\EncryptionServiceProvider',
'Illuminate\Filesystem\FilesystemServiceProvider',
'Illuminate\Hashing\HashServiceProvider',
'Illuminate\Html\HtmlServiceProvider',
'Illuminate\Foundation\Providers\KeyGeneratorServiceProvider',
'Illuminate\Log\LogServiceProvider',
'Illuminate\Mail\MailServiceProvider',
'Illuminate\Foundation\Providers\MaintenanceServiceProvider',
'Illuminate\Database\MigrationServiceProvider',
'Illuminate\Foundation\Providers\OptimizeServiceProvider',
'Illuminate\Pagination\PaginationServiceProvider',
'Illuminate\Foundation\Providers\PublisherServiceProvider',
'Illuminate\Queue\QueueServiceProvider',
'Illuminate\Redis\RedisServiceProvider',
'Illuminate\Auth\Reminders\ReminderServiceProvider',
'Illuminate\Foundation\Providers\RouteListServiceProvider',
'Illuminate\Database\SeedServiceProvider',
'Illuminate\Foundation\Providers\ServerServiceProvider',
'Illuminate\Session\SessionServiceProvider',
'Illuminate\Foundation\Providers\TinkerServiceProvider',
'Illuminate\Translation\TranslationServiceProvider',
'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider',
'Illuminate\Workbench\WorkbenchServiceProvider',
'Way\Generators\GeneratorsServiceProvider',
'Rtablada\Testsuites\TestsuitesServiceProvider',
'Ioffertory\Gateways\GatewaysServiceProvider',
'Ioffertory\Repositories\RepositoriesServiceProvider',
),
/*
|--------------------------------------------------------------------------
| Service Provider Manifest
|--------------------------------------------------------------------------
|
| The service provider manifest is used by Laravel to lazy load service
| providers which are not needed for each request, as well to keep a
| list of all of the services. Here, you may set its storage spot.
|
*/
'manifest' => storage_path().'/meta',
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => array(
'App' => 'Illuminate\Support\Facades\App',
'Artisan' => 'Illuminate\Support\Facades\Artisan',
'Auth' => 'Illuminate\Support\Facades\Auth',
'Blade' => 'Illuminate\Support\Facades\Blade',
'Cache' => 'Illuminate\Support\Facades\Cache',
'ClassLoader' => 'Illuminate\Support\ClassLoader',
'Config' => 'Illuminate\Support\Facades\Config',
'Controller' => 'Illuminate\Routing\Controllers\Controller',
'Cookie' => 'Illuminate\Support\Facades\Cookie',
'Crypt' => 'Illuminate\Support\Facades\Crypt',
'DB' => 'Illuminate\Support\Facades\DB',
'Eloquent' => 'Illuminate\Database\Eloquent\Model',
'Event' => 'Illuminate\Support\Facades\Event',
'File' => 'Illuminate\Support\Facades\File',
'Form' => 'Illuminate\Support\Facades\Form',
'Hash' => 'Illuminate\Support\Facades\Hash',
'HTML' => 'Illuminate\Support\Facades\HTML',
'Input' => 'Illuminate\Support\Facades\Input',
'Lang' => 'Illuminate\Support\Facades\Lang',
'Log' => 'Illuminate\Support\Facades\Log',
'Mail' => 'Illuminate\Support\Facades\Mail',
'Paginator' => 'Illuminate\Support\Facades\Paginator',
'Password' => 'Illuminate\Support\Facades\Password',
'Queue' => 'Illuminate\Support\Facades\Queue',
'Redirect' => 'Illuminate\Support\Facades\Redirect',
'Redis' => 'Illuminate\Support\Facades\Redis',
'Request' => 'Illuminate\Support\Facades\Request',
'Response' => 'Illuminate\Support\Facades\Response',
'Route' => 'Illuminate\Support\Facades\Route',
'Schema' => 'Illuminate\Support\Facades\Schema',
'Seeder' => 'Illuminate\Database\Seeder',
'Session' => 'Illuminate\Support\Facades\Session',
'Str' => 'Illuminate\Support\Str',
'URL' => 'Illuminate\Support\Facades\URL',
'Validator' => 'Illuminate\Support\Facades\Validator',
'View' => 'Illuminate\Support\Facades\View',
'SignupGateway' => 'Facades\SignupGateway',
),
);
<?php namespace Gateways;
use Illuminate\Support\ServiceProvider;
class GatewaysServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app['gateways.signup'] = $this->app->share(function($app)
{
return new SignupGateway(
$this->app['repositories.organization'],
$this->app['repositories.company'],
$this->app['repositories.user'],
$this->app['repositories.profile']
);
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return array('gateways.signup');
}
}
<?php namespace Repositories;
use Bank;
use Campaign;
use Company;
use Donation;
use Donor;
use Organization;
use Profile;
use User;
use Illuminate\Support\ServiceProvider;
class RepositoriesServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->registerBank();
$this->registerCampaign();
$this->registerCompany();
$this->registerDonation();
$this->registerDonor();
$this->registerOrganization();
$this->registerProfile();
$this->registerUser();
}
public function registerBank()
{
$this->app['repositories.bank'] = $this->app->share(function($app)
{
return new EloquentBankRepository(new Bank);
});
}
public function registerCampaign()
{
$this->app['repositories.campaign'] = $this->app->share(function($app)
{
return new EloquentCampaignRepository(new Campaign);
});
}
public function registerCompany()
{
$this->app['repositories.company'] = $this->app->share(function($app)
{
return new EloquentCompanyRepository(new Company);
});
}
public function registerDonation()
{
$this->app['repositories.donation'] = $this->app->share(function($app)
{
return new EloquentDonationRepository(new Donation);
});
}
public function registerDonor()
{
$this->app['repositories.donor'] = $this->app->share(function($app)
{
return new EloquentDonorRepository(new Donor);
});
}
public function registerOrganization()
{
$this->app['repositories.organization'] = $this->app->share(function($app)
{
return new EloquentOrganizationRepository(new Organization);
});
}
public function registerProfile()
{
$this->app['repositories.profile'] = $this->app->share(function($app)
{
return new EloquentProfileRepository(new Profile);
});
}
public function registerUser()
{
$this->app['repositories.user'] = $this->app->share(function($app)
{
return new EloquentUserRepository(new User);
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return array(
'repositories.bank',
'repositories.campaign',
'repositories.company',
'repositories.donation',
'repositories.donor',
'repositories.organization',
'repositories.profile',
'repositories.user',
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment