Do you want CronJob to follow the solar date?You need this package to solve this problem.

Overview

Shamsic

Maybe it happened to you that you wanted to use CronJob in your project and you realized that you cannot manage the exact dates that are in the solar calendar.

For example, cron job allows you to run your script on specific days of the week, month! But CronJob supports the Gregorian calendar.It is useless or can be done with low accuracy for the solar date!

This package allows you to solve this problem inside the PHP code.

This package supports PHP 8.1+.


Install

Via Composer

$ composer require ghaninia/shamsic

How to use

You need to configure the cron job on the server ,The crontab command shown below will activate the cron tasks automatically every minutes:

* * * * * php output.php

'*' is a wildcard, meaning "every time". If you don't have any background about CronJob expressions and don't clear for you, follow the link crontab.

.---------------- minute (0 - 59) 
|  .------------- hour (0 - 23)
|  |  .---------- day of month (1 - 31)
|  |  |  .------- month (1 - 12) 
|  |  |  |  .---- day of week (0 - 6) 
|  |  |  |  |
*  *  *  *  *  command to be executed

The last three expressions of the cronJob are for the day of the month, the month and the day of the week. (Our main problem)

Now, open the file that will be executed by Cron Job (for this example output.php).

use GhaniniaIR\Shamsic\Schedule;

### At every minute on saturday in farvardin.
(new Schedule)
    ->call(function(){
        echo "test";
    })
    ->cron("* * * 1 2");

### At every minute on every day-of-week from saturday through thursday in khordad.
(new Schedule)
    ->call(function(){
        echo "test";
    })
    ->cron("* * * 3 1-5");

... 


### After writing all the schedules, you must run them
Schedule::run();

If you want to check that your expression is valid or not :

(new ExecuteExpression("* * * * *"))->isValid();
You might also like...
Composer registry manager that help to easily switch to the composer repository you want

CRM - Composer Registry Manager Composer Registry Manager can help you easily and quickly switch between different composer repositories. 简体中文 Install

The fixture plugin is really helpful if you want to create some static demo data for your shopware instance.

Fixture Plugin The fixture plugin is really helpful if you want to create some static demo data for your shopware instance. Installation Just add it t

:date: The VObject library for PHP allows you to easily parse and manipulate iCalendar and vCard objects

sabre/vobject The VObject library allows you to easily parse and manipulate iCalendar and vCard objects using PHP. The goal of the VObject library is

Laravel Plans is a package for SaaS apps that need management over plans, features, subscriptions, events for plans or limited, countable features.

Laravel Plans Laravel Plans is a package for SaaS apps that need management over plans, features, subscriptions, events for plans or limited, countabl

A super simple, clean and pretty error handler that replace the default error handler of PHP. You need only include this file!

php-custom-error-handler A super simple, clean and pretty error handler that replace the default error handler of PHP. You need just include only this

Dispatcher is a Laravel artisan command scheduling tool used to schedule artisan commands within your project so you don't need to touch your crontab when deploying.
Dispatcher is a Laravel artisan command scheduling tool used to schedule artisan commands within your project so you don't need to touch your crontab when deploying.

Dispatcher Dispatcher allows you to schedule your artisan commands within your Laravel project, eliminating the need to touch the crontab when deployi

PHP 7+ Payment processing library. It offers everything you need to work with payments: Credit card & offsite purchasing, subscriptions, payouts etc. - provided by Forma-Pro

Supporting Payum Payum is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our

Smart File System - Use SmartFileInfo with useful methods that you need everyday

Smart File System - Use SmartFileInfo with useful methods that you need everyday

This library provides a collection of native enum utilities (traits) which you almost always need in every PHP project.

This library provides a collection of native enum utilities (traits) which you almost always need in every PHP project.

Releases(1.0.1)
Owner
Amin Ghaninia
a simple programmer
Amin Ghaninia
Just the stats I want, maybe you want them too

SKCDEV Easy Digital Downloads Stats This plugin adds a new "SKCDEV EDD Stats" report tab to the EDD Reports tabs. Just the stats I want, maybe you wan

Scott Kingsley Clark 3 Sep 8, 2022
Kirby 3 Plugin for running jobs like cleaning the cache from within the Panel, PHP code, CLI or a cronjob

Kirby 3 Janitor Kirby 3 Plugin for running jobs. It is a Panel Button! It has jobs build-in for cleaning the cache, sessions, create zip-backup, pre-g

Bruno Meilick 68 Dec 21, 2022
This package contains a PHP implementation to solve 3D bin packing problems.

3D Bin Packager This package contains a PHP implementation to solve 3d bin packing problems based on gedex implementation on Go and enzoruiz implement

Farista Latuconsina 7 Nov 21, 2022
This package implements 0-1 Knapsack Problem algorithm i.e. allows to find the best way to fill a knapsack of a specified volume with items of a certain volume and value.

This package implements "0-1 Knapsack Problem" algorithm i.e. allows to find the best way to fill a knapsack of a specified volume with items of a certain volume and value.

Alexander Makarov 9 Sep 8, 2022
Because every Wedding RSVP website needs to follow DDD, CQRS, Hexagonal Architecture, Event Sourcing, and be deployed on Lambda.

Our Wedding Website Because every Wedding RSVP website needs to follow DDD, CQRS, Hexagonal Architecture, Event Sourcing, and be deployed on Lambda. ?

Edd Mann 3 Aug 21, 2022
Dedicated plugin for PocketMine-API 4, this will help staff members to make players follow the rules to the letter

StaffMode Dedicated plugin for PocketMine-API 4, this will help staff members to make players follow the rules to the letter Annotation This plugin is

Kurth 3 Aug 12, 2022
A simple implementation of the api-problem specification. Includes PSR-15 support.

ApiProblem This library provides a simple and straightforward implementation of the IETF Problem Details for HTTP APIs, RFC 7807. RFC 7807 is a simple

Larry Garfield 236 Dec 21, 2022
⭕️ A Knight's Tour problem solver written in php

Knight's tour problem solver A knight's tour problem solver using "Warnsdorff's Rule" - https://vrgl.ir/IB9LJ ?? About the Project ?? Screenshots ?? B

Mahdiyar Ghannad 8 Nov 6, 2022
This project is based on the problem statement provided by the Minstry of HRD (India) for Smart India Hackathon '17.

This project is based on the problem statement provided by the Minstry of HRD (India) for Smart India Hackathon '17. As per the given problem statement, we need to solve the problem of bunching of marks at certain level, and problem of high scorers being at disadvantageous position due to lower competitive percentile.

Saransh Dave 4 Oct 13, 2022