2017 © Pedro Peláez
 

library laravel-application

Getter and Setter package for a Laravel application instance. It serves as an alternative to the app() method, found in the framework's foundation helpers file.

image

aedart/laravel-application

Getter and Setter package for a Laravel application instance. It serves as an alternative to the app() method, found in the framework's foundation helpers file.

  • Friday, September 25, 2015
  • by aedart
  • Repository
  • 0 Watchers
  • 0 Stars
  • 29 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 4 % Grown

The README.md

Laravel-Application (Deprecated, use Aedart/Laravel-Helpers instead)

Getter and Setter package for a Laravel application instance. It serves as an alternative to the app() method, found in the framework's foundation helpers file., (*1)

Contents

[TOC], (*2)

When to use this

When your components needs to be aware of a Laravel application instance, (*3)

How to install

For Laravel version 5.0.x, (*4)

#!console

composer require aedart/laravel-application 1.0.*

This package uses composer. If you do not know what that is or how it works, I recommend that you read a little about, before attempting to use this package., (*5)

Quick start

Provided that you have an interface, e.g. for a command, you can extend the application-aware interface;, (*6)

#!php
<?php
use Aedart\Laravel\Application\Interfaces\ApplicationAware;

interface ICommand extends ApplicationAware {

    // ... Remaining interface implementation not shown ...

}

In your concrete implementation, you simple use the application-traits;, (*7)

#!php
<?php
use Aedart\Laravel\Application\Traits\ApplicationTrait;

class DoSomethingCommand implements ICommand {

    use ApplicationTrait;

    // ... Remaining implementation not shown ... 

}

Default Application instance

The ApplicationTrait will by default return the current running Laravel application instance, if any is available. However, if none is available, null is returned instead., (*8)

To ensure that an application is available, before attempting to use it, please use the hasApplication() and hasDefaultApplication() methods., (*9)

Default Application Validation

By default, the ApplicationTrait will always assume that the specified application instance is valid. However, if you need to ensure that specific configuration has been set or certain service providers are available, or some other kind of application-specific validation, then you can do so, by overriding the isApplicationValid() method., (*10)

#!php
<?php
use Aedart\Laravel\Application\Traits\ApplicationTrait;

class DoSomethingCommand implements ICommand {

    use ApplicationTrait;

    public function isApplicationValid(Application $application){
        // In this example, we ensure that the database default driver
        // is sqlite
        $defaultDriver = $application['config']['database.default'];
        if($defaultDriver == 'sqlite'){
            return true;
        }

        return false;
    }

    // ... Remaining implementation not shown ... 

}

Acknowledgement

Taylor Otwell et al. for one of the best PHP frameworks ever created., (*11)

License

BSD-3-Clause, Read the LICENSE file included in this package, (*12)

The Versions

25/09 2015

dev-master

9999999-dev https://bitbucket.org/aedart/laravel-application

Getter and Setter package for a Laravel application instance. It serves as an alternative to the app() method, found in the framework's foundation helpers file.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Alin Eugen Deac

laravel helper application utility

21/06 2015

1.1.0

1.1.0.0 https://bitbucket.org/aedart/laravel-application

Getter and Setter package for a Laravel application instance. It serves as an alternative to the app() method, found in the framework's foundation helpers file.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Alin Eugen Deac

laravel helper application utility

25/04 2015

1.0.1

1.0.1.0 https://bitbucket.org/aedart/laravel-application

Getter and Setter package for a Laravel application instance. It serves as an alternative to the app() method, found in the framework's foundation helpers file.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Alin Eugen Deac

laravel helper application utility

06/04 2015

1.0.0

1.0.0.0 https://bitbucket.org/aedart/laravel-application

Getter and Setter package for a Laravel application instance. It serves as an alternative to the app() method, found in the framework's foundation helpers file.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Alin Eugen Deac

laravel helper application utility