buzzingpixel / corbomite-user
Corbomite User
Requires
- php: >=7.2
- ext-json: *
- ext-pdo: *
- buzzingpixel/cookie-api: ^2.0.1
- buzzingpixel/corbomite-db: ^1.2.1
- buzzingpixel/corbomite-di: ^1.0
- buzzingpixel/corbomite-events: ^2.0
- buzzingpixel/corbomite-flash-data: ^1.0.1
- buzzingpixel/corbomite-migrations: ^1.0
- buzzingpixel/request-data-store: ^1.0.1
- ramsey/uuid: ^3.8
- symfony/filesystem: ^4.2
- zendframework/zend-diactoros: ^1.8 || ^2.0.0
Requires (Dev)
- buzzingpixel/corbomite-schedule: ^1.0.1
- codedungeon/phpunit-result-printer: ^0.26.2
- doctrine/coding-standard: ^6.0
- friendsofphp/php-cs-fixer: ^2.14
- phpmd/phpmd: ^2.6
- roave/security-advisories: dev-master
- squizlabs/php_codesniffer: ^3.4
- twig/twig: ^2.6
README
Part of BuzzingPixel's Corbomite project.
This project provides user management for corbomite projects.
Usage
When you require this into a Corbomite project, the CLI commands, schedule config, and dependency injection config will automatically be set up.
Installation
Corbomite User needs to add a few database tables in order to function. In order to do this, it needs to create some migrations which then need to be run. Run the create-migrations command, which will place migration files in your Corobomite project.
php app user/create-migrations
After running that command, you'll need to run the migrations:
php app migrate/up
Creating a user from the CLI
A CLI action is provided so you can add a user from the CLI.
php app user/create
The API
Most things you'll need to do are available through the API:
$userApi = Di::get(\corbomite\user\UserApi::class);
Schedule
Make sure you're running the schedule command every minute on a cron job. Corbomite User has two commands that it schedules that need to run in order for everything to work right.
Http Actions
Log In Action
The Login Action is provided to make it easy for you to provide a login form. Here's an example:
{% if dataStore().storeItem('LogInAction.hasError') %} <div class="ErrorBanner"> There was an error logging you in! </div> {% endif %} <form method="post" accept-charset="UTF-8"> {{ getCsrfInput() }} <input type="hidden" name="action" value="logIn"> <input type="email" name="email"> <input type="password" name="password"> <input type="submit"> </form>
{% if flashDataApi().getFlashData().getStoreItem('LogInAction').dataItem('success') ?? false %} Logged in successfully! {% endif %}
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.