Skip to content

saurabhchandrapatel/zf2-php-resque

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#ZF2 PHP Resque Worker in zf2

Dependency

  1. redis server
Instalation
  1. move file resquezf2.global.php.dist from config folder to globle config folder and rename file to resquezf2.global.php
  2. add Resquezf2 in application.config.php file at moduel section to load this moudle.
  3. load Resque Library; add this line to your module.php
    require_once APPLICATION_PATH."/module/Resquezf2/src/Resquezf2/vendor/autoload.php";
  4. if you are useing BjyAuthorize moduel then add this line to your moduel.php to desable its for commond line rout
    <pre>
    $request = $e->getTarget()->getServiceManager()->get('Request'); 
        if ($request instanceof ConsoleRequest) {
            //throw new RuntimeException('You can only use this action from a console!');
            // console desable BjyAuthorize
        }else{
    
            //bjyauthorise navigation
            $authorize = $e->getTarget()->getServiceManager()->get('BjyAuthorizeServiceAuthorize');
            $acl = $authorize->getAcl();
            $role = $authorize->getIdentity();  
    
            // var_dump($acl , $role); exit();
            $parentRoles = $authorize->getIdentityProvider()->getIdentityRoles(); 
            \Zend\View\Helper\Navigation::setDefaultAcl($acl);
            \Zend\View\Helper\Navigation::setDefaultRole($role); 
    
        }
      </pre>
      
      
      otherwise skip this .
    
  5. run worker in commond line
    php public/index.php run-worker
  6. #Add job in queue
    \Resque::setBackend('localhost:6379'); 
    

    $args = array( ); \Resque::enqueue('zf2-php-resque', 'Resquezf2\Model\Job', $args );

  7. you can also create your own class in model location.