Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 14 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<br>

<div align="center">
<img width="456" src="https://raw.githubusercontent.com/wayofdev/laravel-cycle-orm-adapter/master/assets/logo.gh-light-mode-only.png#gh-light-mode-only">
<img width="456" src="https://raw.githubusercontent.com/wayofdev/laravel-cycle-orm-adapter/master/assets/logo.gh-dark-mode-only.png#gh-dark-mode-only">
<img width="456" src="https://raw.githubusercontent.com/wayofdev/laravel-cycle-orm-adapter/master/assets/logo.gh-light-mode-only.png#gh-light-mode-only" alt="Logo for Light Mode">
<img width="456" src="https://raw.githubusercontent.com/wayofdev/laravel-cycle-orm-adapter/master/assets/logo.gh-dark-mode-only.png#gh-dark-mode-only" alt="Logo for Dark Mode">
</div>


Expand All @@ -17,101 +17,43 @@
<a href="https://packagist.org/packages/wayofdev/laravel-cycle-orm-adapter"><img src="https://img.shields.io/packagist/l/wayofdev/laravel-cycle-orm-adapter?style=flat-square&color=blue&logo=packagist" alt="Software License"/></a>
<a href="https://packagist.org/packages/wayofdev/laravel-cycle-orm-adapter"><img alt="Commits since latest release" src="https://img.shields.io/github/commits-since/wayofdev/laravel-cycle-orm-adapter/latest?style=flat-square"></a>
<a href="https://app.codecov.io/gh/wayofdev/laravel-cycle-orm-adapter"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/wayofdev/laravel-cycle-orm-adapter?style=flat-square&logo=codecov"></a>
<a href="https://scrutinizer-ci.com/g/wayofdev/laravel-cycle-orm-adapter"><img alt="Scrutinizer build (GitHub/Bitbucket)" src="https://img.shields.io/scrutinizer/build/g/wayofdev/laravel-cycle-orm-adapter/master?label=scrutinizer&style=flat-square"></a>
<a href=""><img src="https://img.shields.io/badge/phpstan%20level-6%20of%209-yellowgreen?style=flat-square&logo=php"></a>
<a href=""><img src="https://img.shields.io/badge/phpstan%20level-5%20of%209-yellowgreen?style=flat-square&logo=php"></a>
</div>

<br>

<br>

<div align="center">
<img width="320" src="assets/on-white-bg.png#gh-light-mode-only">
<img width="320" src="assets/on-black-bg.png#gh-dark-mode-only">
<img width="320" src="assets/on-white-bg.png#gh-light-mode-only" alt="CycleORM + WayOfDev + Laravel Logo for Light GitHub Mode">
<img width="320" src="assets/on-black-bg.png#gh-dark-mode-only" alt="CycleORM + WayOfDev + Laravel Logo for Dark GitHub Mode">
</div>

<br>

# Laravel Cycle ORM Adapter

Package fully integrates [Cycle ORM](https://cycle-orm.dev) into [Laravel](https://laravel.com) framework.
Unlock the full potential of [Domain-Driven Design](https://en.wikipedia.org/wiki/Domain-driven_design) in your Laravel projects with the [wayofdev/laravel-cycle-orm-adapter](https://github.com/wayofdev/laravel-cycle-orm-adapter) — the adapter package that seamlessly integrates the capabilities of [CycleORM](https://cycle-orm.dev) — DataMapper ORM into [Laravel Framework](https://laravel.com).

* [Laravel Octane](https://laravel.com/docs/9.x/octane) ready!
* [Laravel Telescope](https://laravel.com/docs/9.x/telescope) compatible

If you **like/use** this package, please consider **starring** it. Thanks!
This adapter bridges the gap between Laravel's rapid development capabilities and Cycle ORM's Data Mapper features, enabling you to craft complex, domain-centric applications, with separation of concerns, and a clear distinction between the domain model and the persistence layer.

<br>

## 💿 Installation

### → Using Composer

Require as dependency:

```bash
$ composer req wayofdev/laravel-cycle-orm-adapter
```
If you **like/use** this package, please consider **starring** ⭐️ it. Thanks!

<br>

## 💻 Usage

### → Console Commands

#### Migrations:

| Command | Description |
| ------------------------ | ------------------------------------------------------------ |
| `cycle:migrate` | Perform one or all outstanding migrations.<br />`--one` Execute only one (first) migration. |
| `cycle:migrate:replay` | Replay (down, up) one or multiple migrations.<br />`--all` Replay all migrations. |
| `cycle:migrate:rollback` | Rollback one (default) or multiple migrations.<br />`--all` Rollback all executed migrations. |
| `cycle:migrate:init` | Init migrations component (create migrations table). |
| `cycle:migrate:status` | Get list of all available migrations and their statuses. |

#### Database:

| Command | Description |
| ------------------------ | ------------------------------------------------------------ |
| `cycle:db:list [db]` | Get list of available databases, their tables and records count.<br/>`db` database name. |
| `cycle:db:table <table>` | Describe table schema of specific database.<br/>`table` Table name (required).<br/>`--database` Source database. |
## 📚 Documentation

#### ORM and Schema:

| Command | Description |
| ------------------- | ------------------------------------------------------------ |
| `cycle:orm` | Update (init) cycle schema from database and annotated classes. |
| `cycle:orm:migrate` | Generate ORM schema migrations.<br /> `--run` Automatically run generated migration. |
| `cycle:orm:render` | Render available CycleORM schemas.<br /> `--no-color` Display output without colors. |
| `cycle:orm:sync` | Sync Cycle ORM schema with database without intermediate migration (risk operation). |
The full documentation for the package is available at [https://laravel-cycle-orm-adapter.wayof.dev](https://laravel-cycle-orm-adapter.wayof.dev).

<br>

## 🧪 Running Tests

### → PHPUnit Tests

To run tests, run the following command:

```bash
$ make test
```

### → Static Analysis

Code quality using PHPStan:

```bash
$ make stan
```

### → Coding Standards Fixing
## 🤝 Contributing

Fix code using The PHP Coding Standards Fixer (PHP CS Fixer) to follow our standards:
Contributions are welcome!

```bash
$ make cs-fix
```
If you would like to contribute to the package, please see the [Contributing Guide](https://laravel-cycle-orm-adapter.wayof.dev/contributing) file for more information.

<br>

Expand All @@ -133,7 +75,7 @@ Created in **2022** by [lotyp / wayofdev](https://github.com/wayofdev)

* The official [spiral/cycle-bridge](https://github.com/spiral/cycle-bridge) for Spiral Framework

* Alternative implementation of Cycle ORM for Laravel — [wakebit/laravel-cycle](https://github.com/wakebit/laravel-cycle)
* Alternative implementation of Cycle ORM for Laravel — [wakebit/laravel-cycle](https://github.com/wakebit/laravel-cycle) (abandoned)


<br>
3 changes: 2 additions & 1 deletion docs/pages/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"installation": "Installation",
"configuration": "Configuration",
"usage": "Usage",
"services": "Services"
"services": "Services",
"contributing": "Contributing"
}
58 changes: 58 additions & 0 deletions docs/pages/contributing.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { Callout } from 'nextra-theme-docs'

# Contributing

If you would like to contribute to this project, please open an issue or a pull request. We are always looking for ways to improve the project and would love to hear your ideas.

The latest changes are always in master branch, so please make your Pull Request against that branch.

## 💻 Workflow

<Callout type="warning">
Please feature/fix/update... into individual PRs (not one changing everything)
</Callout>

- Create a github fork.
- On your fork, create a branch, make the changes, commit and push.
- Create a pull-request to the master branch of this repository.

## 🧾 Checklist

### → If Applicable

- tests should be included as a part of your PR
- run `make hooks` to install the git hooks and pre-commit checks
- run `make test` or `make up && make ssh && vendor/bin/pest` to run them.
- `make lint` should be run to ensure the code is properly formatted and phpstan should be run to ensure the code is properly typed.
- documentation should be updated, please provide the corresponding documentation as well and make it part of the Pull Request

## ✉️ Git Message Format

This repo adheres to the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification.
Commit messages are enforced through [commitizen](https://github.com/commitizen-tools/commitizen) and a [pre-commit](https://pre-commit.com), please use `make hooks` to install them.

This leads to more readable messages that are easy to follow when looking through the project history and also allows to generate changelogs automatically.

### → Allowed prefixes for commit messages

- **feat** — A new feature
- **fix** — A bug fix
- **perf** — A code change that improves performance
- **docs** — Documentation only changes
- **style** — Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons)
- **deps** — Changes to the package.json or package-lock.json
- **refactor** — A code change that neither fixes a bug nor adds a feature
- **ci** — Changes to our CI configuration files and scripts
- **test** — Adding missing tests or correcting existing tests
- **revert** — Reverting a previous commit
- **build** — Changes that affect the build system or external dependencies (example scopes: pnpm, renovate, github actions)
- **chore** — Other changes that don't modify src or test files
- **security** — A code change that fixes a security issue

## 🔓 Security Vulnerabilities

If you discover a security vulnerability within this package, please send an e-mail to WayOfDev via the@wayof.dev. All security vulnerabilities will be promptly addressed.

## 🤝 Code of Conduct

We are using the [Contributor Covenant](https://www.contributor-covenant.org/) as our Code of Conduct, to keep discussion open and inclusive. Please, take a moment to read and follow our [Code of Conduct](https://github.com/wayofdev/laravel-cycle-orm-adapter/blob/master/.github/CODE_OF_CONDUCT.md).
10 changes: 3 additions & 7 deletions docs/theme.config.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import React from 'react'
import {DocsThemeConfig, useTheme} from 'nextra-theme-docs'


const Logo = () => {
const {theme} = useTheme();
const {resolvedTheme} = useTheme();
const title = 'Laravel CycleORM Adapter';

const lightLogo = (
Expand All @@ -27,7 +24,6 @@ const Logo = () => {
</svg>
);

// Dark theme logo
const darkLogo = (
<svg className="nx-h-8 nx-w-auto" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1"
x="0px" y="0px" xmlSpace="preserve"
Expand All @@ -48,9 +44,9 @@ const Logo = () => {
return (
<div className="nx-w-full nx-flex nx-items-center">
<div className="nx-flex nx-items-center">
{theme === 'light' ? lightLogo : darkLogo}
{resolvedTheme === 'light' ? lightLogo : darkLogo}
<span
className="nx-ml-2 font-semibold whitespace-nowrap">Laravel CycleORM Adapter</span>
className="nx-ml-2 font-semibold whitespace-nowrap">{title}</span>
</div>
</div>
);
Expand Down