Operatur is a libary to help building background processes around workers and queues.
It also provides an interface for writing workers for different platforms and adapters for docker, azure functions, iron.io workers, aws lambda.
To use, create a 'Workers' folder in your application src. Look into tests\App for usage.
Background jobs best practices
composer require index-io/operatur
Go to your Azure portal, create new function app with "Consumption plan". This app will listen to the storage account you associate when creating the instance.
In your newly created function app, go to "Function app settings", bottom left, then click on "Configure continuous integration". Here set-up your deployment mechanism.
Go to "D:\Program Files (x86)\PHP>", copy all contents from v7.0 to the path "D:\home\site\tools"
cd D:\home\site\tools
cp -r "D:\Program Files\PHP\v7.0\." .
cp -r “D:\Program Files (x86)\PHP\v7.0\.“ .
We will be using the default cacert.pem certificate. First download Curl Certificate and put it somewhere in your repository that is being pushed to Azure. Deploy.
To configure composer we need to connect to the box, using Kudu, and install it manually. Go to "Function app settings" -> "Go to Kudu".
On the Kudu console go to D:\home\site\wwwroot\bin (bin folder might have to be created), and copy paste the following command:
cd D:\home\site\wwwroot
mkdir bin
cd bin
php -r "readfile('https://getcomposer.org/installer');" | php
To use composer globally, create a batch script, run the following in wwwroot:
echo @php "%~dp0\bin\composer.phar" %*>composer.bat
To run composer, go back to wwwroot and run:
composer.bat install
To use composer install, do:
cd D:\home\site\wwwroot
D:\home\site\tools\php.exe bin\composer.phar install
Reference: Run composer on Kudu.
D:\home\site\tools\php.exe bin\composer.phar install
D:\home\site\tools\php.exe bin\composer.phar dumpautoload
Generate skeleton structure, the -p argument is the folder name of where your app sits, default is 'app' but any custom one can be used
vendor/bin/console operatur:skeleton -p app
This command will generate the folders and files necessary for the functions you just wrote that can then be deployed through git or other mechanisms. If config or routes paths are not provided then it will use the default ones located at /app/Workers/config.php and /app/Workers/routes.php
vendor/bin/console operatur:functions -c sample/config.php -r sample/routes.php -p azure-functions
To remove the generated folders / files use the 'remove' argument:
vendor/bin/console operatur:functions remove -c sample/config.php -r sample/routes.php -p azure-functions
$ vendor/bin/phpunit
In the future.
The MIT License (MIT). Please see License File for more information.