GithubHelp home page GithubHelp logo

zodiac's Introduction

Intervention Zodiac Calculator

Installation

You can install this package with Composer.

Require the package via Composer:

$ composer require intervention/zodiac

The calculator class is built to work with the Laravel Framework. The integration is done in seconds.

Open your Laravel config file config/app.php and add service provider in the $providers array:

'providers' => [
    Intervention\Zodiac\ZodiacServiceProvider::class
],

Add the facade of this package to the $aliases array.

'aliases' => [
    'Zodiac' => Intervention\Zodiac\Facades\Zodiac::class
],

Usage

Code Example

Zodiac Calculator Class

You can use the Calculator class to create zodiac objects from any type of date.

// get zodiac from a date
$zodiac = (string) Zodiac::make('1980-09-15'); // virgo

// make method takes mixed formats
$zodiac = (string) Zodiac::make('first day of June 2008'); // gemini

// even DateTime objects
$zodiac = (string) Zodiac::make(new DateTime('1977-03-15')); // pesces

Zodiac Class

The Zodiac Calculator class always returns zodiac objects, which come with the following handy methods.

// make zodiac from a date
$zodiac = Zodiac::make('1980-09-15');

echo $zodiac->name(); // virgo

echo $zodiac->html(); // ♍

echo $zodiac->localized(); // Jungfrau

if ($zodiac instanceof Intervention\Zodiac\Zodiacs\Virgo) {
    # my zodiac sign is virgo ...
}

Eloquent Model Trait

By including Intervention\Zodiac\EloquentZodiacTrait your Eloquent Model gets a new zodiac attribute, which is created based on the birthday attribute of the current model and returns a zodiac object.

// include trait
class User extends Model
{
    use \Intervention\Zodiac\EloquentZodiacTrait;
}

// retrieve zodiac attribute
$user = App\User::create(['birthday' => '1980-03-15']);
$zodiac = $user->zodiac // Intervention\Zodiac\Zodiacs\Pisces

License

Intervention Zodiac is licensed under the MIT License.

Copyright 2016 Oliver Vogel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.