cornford / packtpublr
An easy way to collect free learning ebooks from Packtpub.
Requires
- php: >=5.5.0
- guzzlehttp/guzzle: 4.*
- symfony/console: 3.*
Requires (Dev)
- mockery/mockery: 0.*
- phpspec/phpspec: 2.*
- phpunit/phpunit: 4.*
This package is auto-updated.
Last update: 2024-11-07 07:04:16 UTC
README
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@address.com', 'password' => 'Password'])
This will give you access to
Login
The login
method will login to Packtpublr, with optional parameters for email address and password.
$instance->login();
$instance->login('email@address.com', '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@address.com', 'Password');
License
Packtpublr is open-sourced software licensed under the MIT license