Recommend this page to a friend! |
Download .zip |
Info | Example | View files (7) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2024-01-09 (4 days ago) | Not enough user ratings | Total: 212 This week: 2 | All time: 8,321 This week: 220 |
Version | License | PHP version | Categories | |||
background-service 1.0.9 | BSD License | 5.4 | Networking, PHP 5 |
Description | Author | |
This class can call background services running on socket servers. |
<?php |
This is a implementation in PHP for using BackgroundService written in javascript. (BackgroundService is designed to run in node.js).
This class uses Fuse Array to handle the configuration. - PHPClasses - GitHub
The class uses JBackgroundService as the service manager. - JSClasses - GitHub
Loads the configuration into an ConfigArray (an extension of the class FuseArray)
Convert the data in the mixed-type variable $data from the charset defined in $fromCharset to the charset defined in $toCharset.
Initialize the object.
Returns a string containing the name of the class used in the call.
Create a call to the service defined in configuration. The call is made over a datagram socket.
There is no response to this call.
Create a call to the service defined in configuration and wait for the response. The call is made over a tcp socket.
Make a call to the tcp service. But instead of waiting for the result the process returns directly and this function returns aa string that contains the job id for the process on the server.
This function uses the job id created by TCPAddQueue to check the status for the job.
If the function returns: - 0 then the job has been created but not started. (This should not be possible since the status is changed from 0 to 1 before the TCPAddQueue returns.) - 1 then the job has been started. - 2 then the job is finished.
This function calls the job (defined by the id) and waits until the job is done (has the status 2).
The class is written to use a single configuration. The configuration can use several different services since it connects the name of a service to a section of the configuration.
But there is a way to use multiple configurations.
By extending the base class BackgroundServiceCaller it is possible to load one configuration for each extended class. This is since the internal system uses the name of the called class to store the configuration internally.
<?php
include('./bgcaller.php');
class DummyService1 extends BackgroundServiceCaller {}
class DummyService2 extends BackgroundServiceCaller {}
class DummyService3 extends BackgroundServiceCaller {}
BackgroundServiceCaller::AssignIni('./config0.ini');
DummyService1::AssignIni('./config1.ini');
DummyService2::AssignIni('./config2.ini');
DummyService3::AssignIni('./config3.ini');
// Now we can use four (4) different configurations.
Files |
File | Role | Description | ||
---|---|---|---|---|
examples (4 files) | ||||
bgcaller.php | Class | Class source | ||
LICENSE | Lic. | License text | ||
README.md | Doc. | Documentation |
Files | / | examples |
File | Role | Description |
---|---|---|
example.ini | Data | Auxiliary data |
example1.coffee | Data | Auxiliary data |
example1.php | Example | Example script |
example2.php | Example | Example script |
background-service-2024-01-09.zip 5KB | |
background-service-2024-01-09.tar.gz | |
Install with Composer |
Needed packages | ||
Class | Download | Why it is needed | Dependency |
---|---|---|---|
Fuse Array | .zip .tar.gz | Loads the configuration for the class | Required |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.