Download the PHP package cornford/packtpublr without Composer
On this page you can find all versions of the php package cornford/packtpublr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package packtpublr
An easy way to redeem free learning e-books from Packtpublr
Think of packtpublr as an easy way to redeem free learning e-books from Packtpublr, providing a variety of helpers to speed up the utilisation. These include:
$instance->login$instance->redeem$instance->logout$instance->run$instance->getHttpClient$instance->setHttpClient$instance->getCookieSubscriber$instance->setCookieSubscriber$instance->getResponseBody$instance->getResponseCode$instance->getResponseHeaders
Installation
Begin by installing this package through Composer. Edit your project's composer.json file to require cornford/packtpublr.
"require": {
"cornford/packtpublr": "2.*"
}
Finally, update Composer from the Terminal:
composer update
That's it! You're all set to go.
Configuration
You can now configure Packtpublr in a few simple steps. Open src/config/config.example.php and save it as src/config/config.php and update the options as needed.
email- Packtpub email address.password- Packtpub password.
Schedule
You can set Packtpublr to run as a scheduled item using a Crontab. Firstly run crontab -e and add the following line:
0 9 * * * <PATH_TO_PHP>/php <PATH_TO_PACKTPUBLR>/index.php 2>&1
Usage
It's really as simple as using the Packtpublr class in any Controller / Model / File you see fit with:
$instance = new Packtpublr(['email' => '[email protected]', 'password' => 'Password'])
This will give you access to
- Login
- Redeem
- Logout
- Run
Login
The login method will login to Packtpublr, with optional parameters for email address and password.
$instance->login();
$instance->login('[email protected]', 'Password');
Redeem
The redeem method will redeem the current free learning item on Packtpublr.
$instance->redeem();
Logout
The logout method will logout of Packtpublr.
$instance->logout();
Run
The run method will run a request cycle of login, reddem and logout, with optional parameters for running in console, email address and password.
$instance->logout();
$instance->logout(false, '[email protected]', 'Password');
License
Packtpublr is open-sourced software licensed under the MIT license


