Code Monkey home page Code Monkey logo

masehi-php's Introduction

Masehi PHP

Latest Stable Version Total Downloads Latest Unstable Version License

A library for convert date to Indonesia language, convert time based on timezone and validate date and time

Installation

Download composer.phar if you don't have one. Then run it from terminal.

php composer.phar require "satyakresna/masehi: *"

Or, you can put into your composer.json file.

"require": {
  "satyakresna/masehi": "*"
}

Then run composer update

php composer.phar update

Or, the simple way is go to your root project via terminal or cmd and run this command

composer require satyakresna/masehi

Usage

By default this library will convert date to Indonesia date automatically. If you wish to deny, simply, just set param "is_local" to false.

<?php
require 'vendor/autoload.php';

use Masehi\Converter as MasehiConverter;

$masehi = new MasehiConverter;

# Denied convert to local
echo $masehi->convertDate(array(
  "date" => "2013/08/25",
  "format" => "l, d M Y",
  "is_local" => false,
));
echo "\n";
# Output: Sunday, 25 Aug 2013

echo $masehi->convertDate(array(
  "date" => "2013/08/25",
  "format" => "l, d M Y",
));
echo "\n";
# Output: Minggu, 25 Ags 2013

# Or using static method
echo MasehiConverter::convertDate(array(
  "date" => "now",
  "format" => "l, d M Y",
  "is_local" => false,
));
echo "\n";
# Output: Sunday, 02 Dec 2018

echo MasehiConverter::convertDate(array(
  "date" => "now",
  "format" => "l, d M Y"
));
echo "\n";
# Output: Minggu, 02 Des 2018

You can also use Util class to display list of month on your select dropdown of your system (maybe).

<?php
require 'vendor/autoload.php';

use Masehi\Util;
# Use Util class to display list of local month
print_r(Util::implicitMonths());
echo "\n";

print_r(Util::explicitMonths());
echo "\n";

# Those are will output list of implicit local months and explicit local months

Things on progress

  • Convert time based on timezone
  • Create validator date and time format
  • Create contextual output date and time (ex. 15 jam yang lalu)

How can I contribute?

For a moment I don't received pull request because I want to build this architecture solid. After that I will let you to help me to pull request via code. If just readme, it's fine! Another things to contribute:

  1. USE THIS LIBRARY. IT'S A MUST!
  2. Star the repo
  3. Tell your friends about this awesome library
  4. Drop an issue if you face a problem

masehi-php's People

Contributors

kresnasatya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.