Coder Social home page Coder Social logo

dexit / cron-jobs-manager Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lciolecki/cron-jobs-manager

0.0 2.0 0.0 26 KB

PHP library to manage cron jobs task in application uses some data container like database.

License: BSD 3-Clause "New" or "Revised" License

PHP 96.27% HTML 3.73%

cron-jobs-manager's Introduction

#PHP Cron Jobs Manager

PHP Cron Jobs Manager is simple library to manage cron jobs task in your application. It use some data container like database.

Theory of library

  • Adapter - Representation of connector to data container like Zend_Db, Doctrine, Propel, etc..
  • Job - Representation of models/entities from data container. Has necessary information about task to do.
  • History - Representation of models/entities, has information about status executed job.
  • Task - Representation of thing to do, must extends from \Extlib\Cron\Task\TaskAbstract - implements run() method.

#Sample use

$cron = new \Extlib\Cron(new Doctrine2(array(
    Doctrine2::ENTITY_MANAGER => $entityManager,
    Doctrine2::JOB_ENTITY_NAME => 'Entity\CronJob',
    Doctrine2::JOB_COL_DATE_LAST_RUN => 'dateLastRun',
    Doctrine2::JOB_COL_PRIORITY => 'priority',
    Doctrine2::JOB_COL_STATUS => 'status',
    Doctrine2::HISTORY_ENTITY_NAME => 'Entity\CronHistory'
)));
$cron->execute();

Example application zf+doctrine2

In catalog zf-doctrine-example as name suggest is an example application Zend Framework using Doctrine 2. Please create database using file : */zf-doctrine-example/docs/database.sql. This SQL script create database with two tables: cron_histories and cron_jobs with two task to do (Core_Cron_Task_Test1, Core_Cron_Task_Test2). To run script you must edit Your crontab with command crontab -e and put this line:

* * * * * /usr/bin/php */zf-doctrine-example/bin/cron.php  >> /tmp/cron-logs.log 2>&1

##Installation using Composer

{
    "require": {
        "lciolecki/cron-jobs-manager": "dev-master"
    }
}

cron-jobs-manager's People

Contributors

lciolecki avatar dlizak avatar

Watchers

Rihards Mantejs avatar  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.