buzzingpixel / corbomite-db
Corbomite DB
Requires
- php: >=7.2
- ext-pdo: *
- atlas/cli: ^2.2
- atlas/orm: ^3.1
- buzzingpixel/corbomite-cli: ^1.0
- buzzingpixel/corbomite-di: ^1.0
- ramsey/uuid: ^3.8
Requires (Dev)
- codedungeon/phpunit-result-printer: ^0.26.0
- doctrine/coding-standard: ^6.0
- friendsofphp/php-cs-fixer: ^2.14
- phpmd/phpmd: ^2.6
- phpunit/phpunit: ^8.1
- roave/security-advisories: dev-master
- squizlabs/php_codesniffer: ^3.4
- symfony/var-dumper: ^4.2
README
Part of BuzzingPixel's Corbomite project.
This project provides a very thin layer on top of Atlas to make it available to Corbomite's DI and CLI.
Usage
When you require this into a Corbomite project, the CLI commands and dependency injection config will automatically be set up. But you will need to set up some environment variables.
Environment Variables
The following environment variables are optional:
DB_DSN_PREFIX
(defaults tomysql
)DB_HOST
(defaults tolocalhost
)DB_PORT
(defaults to none, can also set to 'false' to disable)DB_DATABASE
(can also set to 'false' to disable)DB_CHARSET
(defaults toutf8mb4
, can also set to 'false' to disable)
The following environment variables need to be set:
DB_USER
DB_PASSWORD
CORBOMITE_DB_DATA_NAMESPACE
CORBOMITE_DB_DATA_DIRECTORY
The last two tell Corbomite (Atlas) 1). what namespace to use when creating the data skeleton classes, and 2). what directory to put those classes in.
Generating the skeleton
php app db/generate-skeleton
Run the skeleton generation command on first run and any time your database schema changes so all of Atlas' classes will be set up for you to use.
Factory
You should inject \corbomite\db\Factory
into your classes where you need the ORM so you can use the makeOrm
method on the factory to get a new instance of the ORM.
License
Copyright 2019 BuzzingPixel, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.