https://github.com/knowler/wp-capsule
Laravel's Illuminate Capsule configured for WordPress.
https://github.com/knowler/wp-capsule
illuminate-database wordpress
Last synced: about 2 months ago
JSON representation
Laravel's Illuminate Capsule configured for WordPress.
- Host: GitHub
- URL: https://github.com/knowler/wp-capsule
- Owner: knowler
- License: mit
- Created: 2018-11-22T20:39:56.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-09T18:27:30.000Z (almost 7 years ago)
- Last Synced: 2025-04-03T19:47:19.270Z (about 1 year ago)
- Topics: illuminate-database, wordpress
- Language: PHP
- Homepage:
- Size: 14.6 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# WordPress Capsule
[](https://travis-ci.org/knowler/wp-capsule)
Illuminate's [Capsule] preset for WordPress. This is just a
wrapper with a config, so kudos to Laravel for being awesome.
**This is _not_ a plugin, it's a package for use in a WordPress
plugin. Also, note that it presumes that your WordPress site
is using [PHP dotenv] under the hood. It works well if you
are using [Bedrock].**
[Capsule]: https://github.com/illuminate/database
[PHP dotenv]: https://github.com/vlucas/phpdotenv
[Bedrock]: https://github.com/roots/bedrock
## Requirements
* PHP: ^7.1
* [PHP dotenv]
## Installation
```sh
composer require knowler/wp-capsule
```
## Usage
Here's example usage within a plugin:
```php
/** Autoload */
require_once __DIR__ . '/vendor/autoload.php';
/** Boot Capsule */
new KnowlerKnows\WP\Capsule\Boot;
use KnowlerKnows\WP\Capsule\Capsule;
register_activation_hook(__FILE__, function () {
Capsule::schema()->create('products', function ($table) {
$table->increments('id');
$table->string('name');
$table->timestamps();
});
});
register_deactivation_hook(__FILE__, function () {
Capsule::schema()->dropIfExists('products');
});
```
## Contributing
Feel free to make a pull request or report issues. I threw this
together pretty quickly.