2017 © Pedro Peláez
 

library clock-label

Laravel package to manage clock labels like This Month and so on.

image

sukohi/clock-label

Laravel package to manage clock labels like This Month and so on.

  • Saturday, March 26, 2016
  • by Sukohi
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

ClockLabel

Laravel package to manage clock labels like This Month and so on.
This package used to be called TimeLabel that gave us errors after using composer require command., (*1)

Installation

Execute composer command., (*2)

composer require sukohi/clock-label:2.*

Set the service provider in app.php, (*3)

'providers' => [
    ...Others...,  
    Sukohi\ClockLabel\ClockLabelServiceProvider::class,
]

Also alias, (*4)

'aliases' => [
    ...Others...,  
    'ClockLabel'   => Sukohi\ClockLabel\Facades\ClockLabel::class
]

Usage

$clock_label = ClockLabel::setLabel([
    'today' => 'Today',
    'yesterday' => 'Yesterday',
    'this_month' => 'This Month',
    'last_month' => 'Last Month',
    'other' => 'M, Y'   // You need to set date format only here.
]);
$date_clocks = [
    Carbon::now(),
    Carbon::now(),
    Carbon::now()->subDay(),
    Carbon::now()->subDay(),
    Carbon::now()->subDays(2),
    Carbon::now()->subDays(4),
    Carbon::now()->subDays(4),
    Carbon::now()->subDays(5),
    Carbon::now()->subDays(10),
    Carbon::now()->subDays(20),
    Carbon::now()->subDays(50),
    Carbon::now()->subDays(150),
];

foreach($date_clocks as $dt) {

    if($clock_label->isFirst($dt)) {

        echo $clock_label->get($dt) .'<br>';

    }

    echo $dt .'<hr>';

}

License

This package is licensed under the MIT License. Copyright 2016 Sukohi Kuhoh, (*5)

The Versions

26/03 2016

2.0.x-dev

2.0.9999999.9999999-dev

Laravel package to manage clock labels like This Month and so on.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

26/03 2016

dev-master

9999999-dev

Laravel package to manage clock labels like This Month and so on.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

26/03 2016

2.0.0

2.0.0.0

Laravel package to manage clock labels like This Month and so on.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi