{"id":15067066,"url":"https://github.com/unicodeveloper/laravel-leanpub","last_synced_at":"2026-01-02T15:47:15.378Z","repository":{"id":57075434,"uuid":"46356326","full_name":"unicodeveloper/laravel-leanpub","owner":"unicodeveloper","description":":package: A leanpub package for Laravel 5","archived":false,"fork":false,"pushed_at":"2015-11-20T14:12:15.000Z","size":28,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-22T16:22:27.849Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unicodeveloper.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-17T15:32:14.000Z","updated_at":"2020-07-14T22:00:42.000Z","dependencies_parsed_at":"2022-08-24T14:55:43.321Z","dependency_job_id":null,"html_url":"https://github.com/unicodeveloper/laravel-leanpub","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unicodeveloper%2Flaravel-leanpub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unicodeveloper%2Flaravel-leanpub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unicodeveloper%2Flaravel-leanpub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unicodeveloper%2Flaravel-leanpub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unicodeveloper","download_url":"https://codeload.github.com/unicodeveloper/laravel-leanpub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243822310,"owners_count":20353498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-25T01:15:54.443Z","updated_at":"2026-01-02T15:47:15.351Z","avatar_url":"https://github.com/unicodeveloper.png","language":"PHP","readme":"# laravel-leanpub\n\n[![Latest Stable Version](https://poser.pugx.org/unicodeveloper/laravel-leanpub/v/stable.svg)](https://packagist.org/packages/unicodeveloper/laravel-leanpub)\n[![License](https://poser.pugx.org/unicodeveloper/laravel-leanpub/license.svg)](LICENSE.md)\n![](https://img.shields.io/badge/unicodeveloper-approved-brightgreen.svg)\n[![Build Status](https://img.shields.io/travis/unicodeveloper/laravel-leanpub.svg)](https://travis-ci.org/unicodeveloper/laravel-leanpub)\n[![Quality Score](https://img.shields.io/scrutinizer/g/unicodeveloper/laravel-leanpub.svg?style=flat-square)](https://scrutinizer-ci.com/g/unicodeveloper/laravel-leanpub)\n[![Total Downloads](https://img.shields.io/packagist/dt/unicodeveloper/laravel-leanpub.svg?style=flat-square)](https://packagist.org/packages/unicodeveloper/laravel-leanpub)\n\n\u003e Laravel 5 Package to work with Leanpub. Very easy to use. Offers the use of Facades and Dependency Injection\n\n**Disclaimer:** Leanpub is a service of Ruboss Technology Corporation, a corporation incorporated in British Columbia, Canada. I self-publish a book\nusing their service, but am otherwise not affiliated with them in any way.\n\n## Installation\n\n[PHP](https://php.net) 5.5+ or [HHVM](http://hhvm.com) 3.3+, and [Composer](https://getcomposer.org) are required.\n\nFirst, pull in the package through Composer.\n\n``` bash\n$ composer require unicodeveloper/laravel-leanpub\n```\n\nAnother alternative is to simply add the following line to the require block of your `composer.json` file.\n\n```\n\"unicodeveloper/laravel-leanpub\": \"1.0.*\"\n```\n\nThen run `composer install` or `composer update` to download it and have the autoloader updated.\n\nAdd this to your providers array in `config/app.php`\n\n```php\n// Laravel 5: config/app.php\n\n'providers' =\u003e [\n    ...\n    Unicodeveloper\\Leanpub\\LeanpubServiceProvider::class,\n    ...\n];\n```\n\nThis package also comes with a facade\n\n```php\n// Laravel 5: config/app.php\n\n'aliases' =\u003e [\n    ...\n    'Leanpub' =\u003e Unicodeveloper\\Leanpub\\Facades\\Leanpub::class,\n    ...\n]\n```\n\nPublish the config file by running:\n\n```bash\nphp artisan vendor:publish\n```\n\nThe config file will now be located at `config/leanpub.php`.\n\n## Configuration\n\nThis is the `leanpub.php` file in the `config` directory.\n\n```php\n/**\n *  Config file that a developer can insert the api key from Leanpub\n */\nreturn [\n    'API_KEY' =\u003e ''\n];\n```\n\n## Usage\n\nYou'll need your book slug and API key values, both of which can be retrieved by [accessing your Leanpub account](https://leanpub.com/dashboard).\n\n##### LeanpubManager\n\nThis is the class of most interest. It is bound to the ioc container as `'laravel-leanpub'` and can be accessed using the `Facades\\Leanpub` facade.\n\n##### Facades\\Leanpub\n\nThis facade will dynamically pass static method calls to the `'laravel-leanpub'` object in the ioc container which by default is the `LeanpubManager` class.\n\n\n##### Examples\n\nHere you can see an example of just how simple this package is to use.\n\n```php\nuse Unicodeveloper\\Leanpub\\Facades\\Leanpub;\n// or you can alias this in config/app.php like I mentioned initially above\n\nBook Summary Data\n\nLeanpub::getBook($book_slug)-\u003eid;\n// e.g sample $book_slug is phptherightway returns 11146\n\nLeanpub::getBook($book_slug)-\u003eabout_the_book;\n// e.g sample $book_slug is phptherightway returns\n\n \u003cp\u003e\u003cem\u003eThere is no canonical way to use PHP\u003c/em\u003e. This website aims to introduce new PHP developers to some topics which they may not discover until it is too late, and aims to give seasoned pros some fresh ideas on those topics they’ve been doing for years without ever reconsidering. This ebook will also not tell you which tools to use, but instead offer suggestions for multiple options, when possible explaining the differences in approach and use-case.\u003c/p\u003e\\r\\n\n \u003cp\u003eThis is a living document and will continue to be updated with more helpful information and examples as they become available.\u003c/p\u003e\n\nLeanpub::getBook($book_slug)-\u003etitle;\n// e.g sample $book_slug is phptherightway returns PHP: The \"Right\" Way\n\nLeanpub::getBook($book_slug)-\u003etotal_copies_sold;\n// e.g sample $book_slug is phptherightway returns 12056\n\nLeanpub::getBook($book_slug)-\u003eword_count_published;\n// e.g sample $book_slug is phptherightway returns 15849\n\nLeanpub::getBook($book_slug)-\u003eauthor_string;\n// e.g sample $book_slug is phptherightway returns \"Phil Sturgeon and Josh Lockhart\"\n\nLeanpub::getBook($book_slug)-\u003eurl;\n// e.g sample $book_slug is phptherightway returns \"http://leanpub.com/phptherightway\"\n\nLeanpub::getBook($book_slug)-\u003etitle_page_url;\n// e.g sample $book_slug is phptherightway returns \"https://s3.amazonaws.com/titlepages.leanpub.com/phptherightway/original?1425544606\"\n\nLeanpub::getBook($book_slug)-\u003eminimum_price;\n// e.g sample $book_slug is phptherightway returns 0.0\n\nLeanpub::getBook($book_slug)-\u003esuggested_price;\n// e.g sample $book_slug is phptherightway returns 0.0\n\nLeanpub::getBook($book_slug)-\u003eimage;\n// e.g sample $book_slug is phptherightway returns \"https://s3.amazonaws.com/titlepages.leanpub.com/phptherightway/medium?1425544606\"\n\nLeanpub::getBook($book_slug)-\u003eisFree;\n// e.g sample $book_slug is phptherightway returns true\n\nLeanpub::getBook($book_slug)-\u003elast_published_at;\n// e.g sample $book_slug is phptherightway returns \"2015-01-05T16:37:01Z\"\n\nLeanpub::getBook($book_slug)-\u003emeta_description;\n// e.g sample $book_slug is phptherightway returns null\n\nLeanpub::getBook($book_slug)-\u003epage_count_published;\n// e.g sample $book_slug is phptherightway returns 70\n\nLeanpub::getBook($book_slug)-\u003esubtitle;\n// e.g sample $book_slug is phptherightway returns \"Your guide to PHP best practices, coding standards,  and authoritative tutorials.\"\n\nLeanpub::getBook($book_slug)-\u003etotal_revenue;\n// e.g sample $book_slug is phptherightway returns the price in revenue if the book is not free. For a book that is free like this, there is no `total_revenue` attribute\n\nLeanpub::getBook($book_slug)-\u003epossible_reader_count;\n// e.g sample $book_slug is phptherightway returns 12052\n\nSales Summary Data\n\nLeanpub::getSalesInfo($book_slug)-\u003ebook\nLeanpub::getSalesInfo($book_slug)-\u003eurl\nLeanpub::getSalesInfo($book_slug)-\u003etotal_author_royalties\nLeanpub::getSalesInfo($book_slug)-\u003etotal_book_royalties\nLeanpub::getSalesInfo($book_slug)-\u003enum_happy_readers\nLeanpub::getSalesInfo($book_slug)-\u003enum_happy_paid_purchases\nLeanpub::getSalesInfo($book_slug)-\u003enum_refunded_purchases\nLeanpub::getSalesInfo($book_slug)-\u003eunpaid_royalties\nLeanpub::getSalesInfo($book_slug)-\u003eroyalties_currently_due\nLeanpub::getSalesInfo($book_slug)-\u003eroyalties_due_on_first_of_next_month\nLeanpub::getSalesInfo($book_slug)-\u003epaid_royalties\n\n```\n\n\n## TODO\n\nAdd wrappers for other API functionalities:\n\n- All sales data\n- Preview functions\n- Publish functions\n- Preview/publish job status\n- Coupon management\n- Testing\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Testing\n\nYou can run the tests with:\n\n```bash\nvendor/bin/phpunit run\n```\n\nAlternatively, you can run the tests like so:\n\n```bash\ncomposer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Credits\n\n- [Prosper Otemuyiwa](https://twitter.com/unicodeveloper)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n## Security\n\nIf you discover any security related issues, please email [prosperotemuyiwa@gmail.com](prosperotemuyiwa@gmail.com) instead of using the issue tracker.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funicodeveloper%2Flaravel-leanpub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funicodeveloper%2Flaravel-leanpub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funicodeveloper%2Flaravel-leanpub/lists"}