- Added autoload component into composer.json
This commit is contained in:
		
							parent
							
								
									a364a51f85
								
							
						
					
					
						commit
						ad8cb45cdc
					
				| @ -1,12 +1,13 @@ | ||||
| { | ||||
|     "name": "mcnd/cronard", | ||||
|     "description": "A cron library which allows task to be run easily into an application.", | ||||
|     "keywords": ["cronard","cron","task","psr15","middleware"], | ||||
|     "type": "library", | ||||
|     "license": "MIT", | ||||
|     "authors": [ | ||||
|         { | ||||
|             "name": "Dave Mc Nicoll", | ||||
|             "email": "mcndave@gmail.com" | ||||
|             "email": "info@mcnd.ca" | ||||
|         } | ||||
|     ], | ||||
|     "require": {}, | ||||
| @ -14,5 +15,14 @@ | ||||
|         "psr-4": { | ||||
|             "Cronard\\": "src/" | ||||
|         } | ||||
|     }, | ||||
|     "extra" : { | ||||
|         "lean" : { | ||||
|             "autoload": { | ||||
|                 "definitions" : [ | ||||
|                     "meta/cronard.php" | ||||
|                 ] | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
							
								
								
									
										32
									
								
								meta/cronard.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								meta/cronard.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,32 @@ | ||||
| <?php | ||||
| 
 | ||||
| use function DI\autowire, DI\create, DI\get; | ||||
| 
 | ||||
| use Laminas\Diactoros\Response\HtmlResponse; | ||||
| 
 | ||||
| use Cronard\CronardMiddleware, | ||||
|     Notes\Cronard\TaskFetcher; | ||||
| 
 | ||||
| use Psr\Http\Message\ResponseInterface; | ||||
| 
 | ||||
| use Lean\Lean; | ||||
| 
 | ||||
| return [ | ||||
|     CronardMiddleware::class => function($c) { | ||||
|         $cronardMiddleware = new CronardMiddleware($c, getenv('CRON_KEY'), function() : ResponseInterface { | ||||
|             return new HtmlResponse(sprintf("%s - cron task begin...", date('Y-m-d H:i:s'))); | ||||
|         }, [], $c->get(TaskFetcher::class)); | ||||
| 
 | ||||
|         return $cronardMiddleware->fromFile(getenv("META_PATH")."/crontab.php")->fromAnnotations($c->get(TaskFetcher::class)); | ||||
|     }, | ||||
| 
 | ||||
|     TaskFetcher::class => function($c) { | ||||
|         $fetcher = new TaskFetcher(null, null, $c->get('cronard.caching')); | ||||
| 
 | ||||
|         $fetcher->setFolderList(array_map(function($item) { | ||||
|             return $item; | ||||
|         }, $c->get(Lean::class)->getCronard())); | ||||
| 
 | ||||
|         return $fetcher; | ||||
|     }, | ||||
| ]; | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user