承接 dominiquevienne/swiss-off 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dominiquevienne/swiss-off

Composer 安装命令:

composer require dominiquevienne/swiss-off

包简介

PHP Library used to know if a day is off in a given Swiss Canton

关键字:

README 文档

README

Library used to know if a day is off in a given Swiss Canton

Installation

Recommended

Go to you project root directory and use composer using this command

composer require dominiquevienne/swiss-off

Then create your application bootstrap using this kind of code

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

$oCanton  = new Dominiquevienne\SwissOff\Canton();
echo date('Y-m-d H:i:s',$oCanton->getNextDayOffByCanton('VD'));

Manual installation

  • Download latest stable release on Github
  • Uncompress the downloaded file
  • Place content into your project
  • Use similar code to load object
<?php
require __DIR__ . '/swiss-off/src/SwissOff.php';
require __DIR__ . '/swiss-off/src/Canton.php';

$oCanton  = new Dominiquevienne\SwissOff\Canton();
echo date('Y-m-d H:i:s',$oCanton->getNextDayOffByCanton('VD'));

Laravel

Using swissOff in Laravel is as simple as a

composer require dominiquevienne/swiss-off

and add the following lines in your class

<?php
use Dominiquevienne\SwissOff\Canton;

class yourController {
  public function show() {
    /** some code of yours */
    $oCanton  = new Canton();
    return date('Y-m-d H:i:s',$oCanton->getNextDayOffByCanton('VD'));
  }
}

Available functions

Note: time is always given to functions and returned as a timestamp.

Canton

getDaysOffByCantonAndTime($canton, $time = null)

This function will return an array containing every day off of the year of the given time for the specified canton (two letters code).

If no time is given, current time will be used.

getDaysOffNames()

This function will return an array containing all days off machine name (eg. Christmas, Berchtold, ...)

getCantonsByDayOffName($dayOffName)

This function will return an array containing all cantons that are off for this day off.

getNextDayOffByCanton($canton, $time = null)

This function will return a timestamp corresponding to the next day off after the given time for the given canton.

If no time is given, current time will be used.

getNextDaysOff($time = null)

This function will return an associative array which will contain canton two letters code / time of its next day off after the given time.

If no time is given, current time will be used.

SwissOff

SwissOff object consists of a list of isSpecificDayOff and getSpecificDayOff function that will check if given time is, for example, Easter / Christmas / Palm Sunday / ... and get the day off.

For example getChristmas($time = null) will return the timestamp of the Christmas date of the year of the given time.

isChristmas($time = null) will check if the given time corresponds to a Christmas day

Functions name are constructed using is + day off machine name (case sensitive) which are listed below:

  • Easter
  • Christmas
  • NewYear
  • Berchtold
  • Epiphany
  • RepublicDay
  • Joseph
  • Nafelser
  • Palm
  • GoodFriday
  • EasterMonday
  • LaborDay
  • Ascension
  • Pentecost
  • WhitMonday
  • CorpusChristi
  • Independance
  • PeterPaul
  • National
  • Assumption
  • JeuneGenevois
  • Thanksgiving
  • Jeune
  • NicolasFlue
  • AllSaint
  • Immaculate
  • Stephen
  • Restoration
  • NewEve

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2017-06-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固