Skip to content

Commit e3e8435

Browse files
committed
docs: configuration section, external links, icons
1 parent 0cf5139 commit e3e8435

21 files changed

+204
-56
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ The full documentation for the package is available at [https://laravel-cycle-or
5959

6060
<br>
6161

62-
## 🤝 Contributing
62+
## 📥 Contributing
6363

6464
Contributions are welcome!
6565

config/cycle.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,12 @@
159159
* Use any of channels configured in your logging.php file
160160
*/
161161
'logger' => [
162-
'default' => env('DB_DEFAULT_LOGGER_CHANNEL', null),
162+
'default' => env('DB_DEFAULT_LOGGER', null),
163163
'drivers' => [
164-
'sqlite' => env('DB_DEFAULT_LOGGER_CHANNEL', null),
165-
'pgsql' => env('DB_DEFAULT_LOGGER_CHANNEL', null),
166-
'mysql' => env('DB_DEFAULT_LOGGER_CHANNEL', null),
167-
'sqlserver' => env('DB_DEFAULT_LOGGER_CHANNEL', null),
164+
'sqlite' => env('DB_DEFAULT_LOGGER', null),
165+
'pgsql' => env('DB_DEFAULT_LOGGER', null),
166+
'mysql' => env('DB_DEFAULT_LOGGER', null),
167+
'sqlserver' => env('DB_DEFAULT_LOGGER', null),
168168
],
169169
],
170170
],
@@ -272,6 +272,6 @@
272272
* @see https://github.com/cycle/entity-behavior
273273
*/
274274
'entityBehavior' => [
275-
'register' => true,
275+
'register' => env('CYCLE_REGISTER_ENTITY_BEHAVIOUR', true),
276276
],
277277
];
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import styles from './style.module.css'
2+
3+
export function OptionTable({ options }: { options: [string, string, string, string][] }) {
4+
const createMarkup = (htmlContent) => {
5+
return { __html: htmlContent };
6+
};
7+
8+
return (
9+
<div
10+
className={
11+
'-mx-6 mb-4 mt-6 overflow-x-auto overscroll-x-contain px-6 pb-4 ' +
12+
styles.container
13+
}
14+
>
15+
<table className="w-full border-collapse text-sm">
16+
<thead>
17+
<tr className="border-b py-4 text-left dark:border-neutral-700">
18+
<th className="py-2 font-semibold">Environment Variable</th>
19+
<th className="py-2 pl-6 font-semibold">Available Values</th>
20+
<th className="py-2 pl-6 font-semibold">Default</th>
21+
<th className="px-6 py-2 font-semibold">Description</th>
22+
</tr>
23+
</thead>
24+
<tbody className="align-baseline text-gray-900 dark:text-gray-100">
25+
{options.map(([variable, values, defaultValue, description]) => (
26+
<tr
27+
key={variable}
28+
className="border-b border-gray-100 dark:border-neutral-700/50"
29+
>
30+
<td className="whitespace-pre py-2 font-mono text-xs font-semibold leading-6 text-violet-600 dark:text-violet-500">
31+
{variable}
32+
</td>
33+
<td className="whitespace-pre py-2 pl-6 font-mono text-xs font-semibold leading-6 text-slate-500 dark:text-slate-400">
34+
{values}
35+
</td>
36+
<td className="whitespace-pre py-2 pl-6 font-mono text-xs font-semibold leading-6 text-slate-500 dark:text-slate-400">
37+
{defaultValue}
38+
</td>
39+
<td className="py-2 pl-6" dangerouslySetInnerHTML={createMarkup(description)}></td>
40+
</tr>
41+
))}
42+
</tbody>
43+
</table>
44+
</div>
45+
)
46+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.container {
2+
mask-image: linear-gradient(
3+
to right,
4+
transparent 0.8em,
5+
white 1.5em,
6+
white calc(100% - 1.5em),
7+
transparent calc(100% - 0.8em)
8+
);
9+
}
10+
11+
.container::-webkit-scrollbar {
12+
appearance: none;
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
import { ArrowTopRightOnSquareIcon } from "@heroicons/react/20/solid";
3+
4+
const ExternalLink = ({ href, children }) => {
5+
return (
6+
<a href={href} target="_blank" className="nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font] inline-flex items-center gap-0.5">
7+
{children}
8+
<ArrowTopRightOnSquareIcon className="size-4" />
9+
</a>
10+
);
11+
};
12+
13+
export default ExternalLink;

docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
},
2020
"homepage": "https://github.com/shuding/nextra-docs-template#readme",
2121
"dependencies": {
22+
"@heroicons/react": "^2.1.1",
2223
"@vercel/analytics": "^1.2.2",
2324
"next": "^14.1.3",
2425
"nextra": "latest",

docs/pages/configuration.mdx

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,52 @@
1+
import {
2+
Callout
3+
} from "nextra-theme-docs";
4+
import {OptionTable} from "../components/env-table";
5+
16
# Configuration
7+
8+
This section guides you through configuring the Laravel-CycleORM-Adapter package within your Laravel application. Configuration settings are managed in the `config/cycle.php` file. Ensure you have this file in your project by following the steps outlined in the [Installation](/installation) guide.
9+
10+
## 🌎 Environment Variables
11+
12+
### Database Connection Variables
13+
14+
This section details the environment variables for database connections. Our package uses Laravel's standard variables and introduces additional settings for CycleORM integration. Configure these in your `.env` file as needed or override them in your `config/cycle.php` file.
15+
16+
These are variables, that will be in `.env` file of your Laravel project from the box, and are used by `config/cycle.php` to configure CycleORM.
17+
18+
<OptionTable
19+
options={[
20+
["DB_CONNECTION", "string", "sqlite", "Database driver: `pgsql`, `mysql`, `sqlite`, `sqlserver`."],
21+
["DB_HOST", "string", "127.0.0.1", "Database server hostname or IP."],
22+
["DB_PORT", "integer", "by-driver", "The database port, driver specific."],
23+
["DB_DATABASE", "string", "wod", "The database name."],
24+
["DB_USERNAME", "string", "wod", "The database username."],
25+
["DB_PASSWORD", "string", "wod", "The database password."]
26+
]}
27+
/>
28+
29+
### Additional Variables
30+
31+
These variables offer further customization for CycleORM's operation within Laravel.
32+
33+
<Callout type="info" emoji="💡">
34+
Add these manually in your `.env` file to modify default behaviors, or use the `config/cycle.php` file to override them.
35+
</Callout>
36+
37+
<OptionTable
38+
options={[
39+
["DB_DEFAULT_CONNECTION", "string", "default", "The default database connection."],
40+
["DB_DEFAULT_LOGGER", "?string", "null", "Laravel logger channel, to log queries. Loggers can be added in `config/logging.php`"],
41+
["DB_MIGRATIONS_TABLE", "string", "cycle_migrations", "The table name for the migrations."],
42+
["CYCLE_TOKENIZER_CACHE_TARGETS", "boolean", "true", "Determines whether to cache located classes utilizing annotations."],
43+
["CYCLE_TOKENIZER_LOAD_CLASSES", "boolean", "true", "Controls whether files of type `class` should be loaded."],
44+
["CYCLE_TOKENIZER_LOAD_ENUMS", "boolean", "false", "Controls whether files of type `enum` should be loaded."],
45+
["CYCLE_TOKENIZER_LOAD_INTERFACES", "boolean", "false", "Controls whether files of type `interface` should be loaded."],
46+
["CYCLE_ATTRIBUTES_CACHE", "boolean", "true", "Determines whether located attributes should be cached."],
47+
["CYCLE_ATTRIBUTES_CACHE_DRIVER", "string", "file", "Specifies the cache driver to use, selectable from the stores defined in `config/cache.php`."],
48+
["DB_DEFAULT_COLLECTION", "string", "illuminate", "Sets the default collection implementation: `array`, `illuminate`, `doctrine`."],
49+
["CYCLE_SCHEMA_WARMUP", "boolean", "true", "Indicates whether the schema cache should be preloaded."],
50+
["CYCLE_REGISTER_ENTITY_BEHAVIOUR", "boolean", "true", "Enables support of `SoftDelete` and other behaviours from <a class=\"nx-text-primary-600 nx-underline nx-decoration-from-font [text-underline-position:from-font]\" target=\"_blank\" href=\"https://github.com/cycle/entity-behavior\">cycle/entity-behavior</a>"]
51+
]}
52+
/>

docs/pages/contributing.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Callout } from 'nextra-theme-docs'
2+
import ExternalLink from "../components/external-link";
23

34
# Contributing
45

@@ -28,8 +29,8 @@ The latest changes are always in master branch, so please make your Pull Request
2829

2930
## ✉️ Git Message Format
3031

31-
This repo adheres to the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification.
32-
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.
32+
This repo adheres to the <ExternalLink href="https://www.conventionalcommits.org/en/v1.0.0/">Conventional Commits</ExternalLink> specification.
33+
Commit messages are enforced through <ExternalLink href="https://github.com/commitizen-tools/commitizen">commitizen</ExternalLink> and a <ExternalLink href="https://pre-commit.com">pre-commit</ExternalLink>, please use `make hooks` to install them.
3334

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

@@ -61,15 +62,15 @@ $ make test
6162

6263
### → Static Analysis
6364

64-
Run Code quality checks using [PHPStan](https://phpstan.org):
65+
Run Code quality checks using <ExternalLink href="https://phpstan.org">PHPStan</ExternalLink>:
6566

6667
```bash
6768
$ make lint-stan
6869
```
6970

7071
### → Coding Standards Fixing
7172

72-
Fix code using [The PHP Coding Standards Fixer](https://github.com/wayofdev/php-cs-fixer-config) to follow our standards:
73+
Fix code using <ExternalLink href="https://github.com/wayofdev/php-cs-fixer-config">The PHP Coding Standards Fixer</ExternalLink> to follow our standards:
7374

7475
```bash
7576
$ make lint-php
@@ -81,4 +82,4 @@ If you discover a security vulnerability within this package, please send an e-m
8182

8283
## 🤝 Code of Conduct
8384

84-
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).
85+
We are using the <ExternalLink href="https://www.contributor-covenant.org">Contributor Covenant</ExternalLink> as our Code of Conduct, to keep discussion open and inclusive. Please, take a moment to read and follow our <ExternalLink href="https://github.com/wayofdev/laravel-cycle-orm-adapter/blob/master/.github/CODE_OF_CONDUCT.md">Code of Conduct</ExternalLink>.

docs/pages/index.mdx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import ExternalLink from "../components/external-link";
2+
13
# Introduction
24

3-
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).
5+
Unlock the full potential of Domain-Driven Design in your Laravel projects with the <ExternalLink href="https://github.com/wayofdev/laravel-cycle-orm-adapter">laravel-cycle-orm-adapter</ExternalLink> — the adapter package that seamlessly integrates the capabilities of <ExternalLink href="https://cycle-orm.dev">CycleORM</ExternalLink> — DataMapper ORM into <ExternalLink href="https://laravel.com">Laravel Framework</ExternalLink>.
46

5-
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.
7+
This adapter bridges the gap between Laravel's rapid development capabilities and CycleORM'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.
68

79
## 🧐 Understanding the Limitations of Eloquent
810

@@ -19,15 +21,15 @@ The Active Record pattern tightly couples domain logic and data persistence with
1921

2022
There were many attempts to bring DDD to Laravel:
2123

22-
* [Laravel Beyond CRUD approach](https://laravel-beyond-crud.com) by Spatie
24+
* <ExternalLink href="https://laravel-beyond-crud.com">Laravel Beyond CRUD approach</ExternalLink> by Spatie
2325

24-
* [Conciliating Laravel and DDD](https://lorisleiva.com/conciliating-laravel-and-ddd) by Loris Leiva
26+
* <ExternalLink href="https://lorisleiva.com/conciliating-laravel-and-ddd">Conciliating Laravel and DDD</ExternalLink> by Loris Leiva
2527

26-
* [Yet another Laravel 10 DDD interpretation](https://github.com/Orphail/laravel-ddd)
28+
* <ExternalLink href="https://github.com/Orphail/laravel-ddd">Yet another Laravel 10 DDD interpretation</ExternalLink>
2729

2830
these often involve workarounds to adapt Eloquent rather than a fundamental shift in approach.
2931

30-
The `laravel-cycle-orm-adapter` bridges this gap, by introducing DataMapper pattern capabilities to Laravel, empowering you to unlock the full potential of DDD within your projects.
32+
The <ExternalLink href="https://github.com/wayofdev/laravel-cycle-orm-adapter">laravel-cycle-orm-adapter</ExternalLink> bridges this gap, by introducing DataMapper pattern capabilities to Laravel, empowering you to unlock the full potential of DDD within your projects.
3133

3234
Here's why this combination shines:
3335

@@ -40,20 +42,20 @@ Here's why this combination shines:
4042

4143
## 🚀 Features
4244

43-
### Laravel Cycle ORM Adapter Features
44-
- **Seamless Integration**: The adapter is designed to work seamlessly with Laravel, allowing you to use Cycle ORM in your Laravel projects without any hassle.
45+
### Laravel CycleORM Adapter Features
46+
- **Seamless Integration**: The adapter is designed to work seamlessly with Laravel, allowing you to use CycleORM in your Laravel projects without any hassle.
4547
- **Entity as Source of Truth for Database Migrations**: The adapter allows you to use your domain entities as the source of truth for your database schema, making it easier to keep your database schema in sync with your domain model.
46-
- **Laravel Collections Support**: The adapter provides support for [Laravel Collections](https://laravel.com/docs/10.x/collections), allowing you to use them with your domain models and repositories
47-
- **Database Factories**: Use Laravel database seeders together with CycleORM Entity Factories via [wayofdev/laravel-cycle-orm-factories](https://github.com/wayofdev/laravel-cycle-orm-factories)
48-
- **Real Repositories**: [Avoid breaking the Repository Design Pattern in Laravel](https://medium.com/@sergiumneagu/laravel-why-youve-been-using-the-repository-pattern-the-wrong-way-952aedf1989b), maintaining a clear separation between your domain logic and the persistence layer.
48+
- **Laravel Collections Support**: The adapter provides support for <ExternalLink href="https://laravel.com/docs/10.x/collections">Laravel Collections</ExternalLink>, allowing you to use them with your domain models and repositories
49+
- **Database Factories**: Use Laravel database seeders together with CycleORM Entity Factories via <ExternalLink href="https://github.com/wayofdev/laravel-cycle-orm-factories">wayofdev/laravel-cycle-orm-factories</ExternalLink>
50+
- **Real Repositories**: <ExternalLink href="https://medium.com/@sergiumneagu/laravel-why-youve-been-using-the-repository-pattern-the-wrong-way-952aedf1989b">Avoid breaking the Repository Design Pattern in Laravel</ExternalLink>, maintaining a clear separation between your domain logic and the persistence layer.
4951

5052

51-
### Cycle ORM Features
52-
- **Domain-Driven Design**: Cycle ORM is designed to work with complex domain models, making it a perfect fit for DDD.
53-
- **Data Mapper**: Cycle ORM is a Data Mapper ORM, which means that it allows you to define your domain models and their relationships in a way that is more natural and expressive.
54-
- **Powerful Query Builder**: Cycle ORM provides a powerful query builder that allows you to write complex queries in a way that is easy to read and understand.
55-
- **Schema Management**: Cycle ORM provides powerful schema management capabilities, allowing you to define your database schema using PHP code.
53+
### CycleORM Features
54+
- **Domain-Driven Design**: CycleORM is designed to work with complex domain models, making it a perfect fit for DDD.
55+
- **Data Mapper**: CycleORM is a Data Mapper ORM, which means that it allows you to define your domain models and their relationships in a way that is more natural and expressive.
56+
- **Powerful Query Builder**: CycleORM provides a powerful query builder that allows you to write complex queries in a way that is easy to read and understand.
57+
- **Schema Management**: CycleORM provides powerful schema management capabilities, allowing you to define your database schema using PHP code.
5658

5759
## 🛠️ Want to see it in action?
5860

59-
Explore the Laravel CycleORM Starter Kit project: [laravel-cycle-orm-starter-kit](https://github.com/wayofdev/laravel-cycle-starter-tpl), based on Laravel 10.x. It showcases the practical use of the adapter in a real-world application, demonstrating how to leverage CycleORM's strengths within a Laravel project.
61+
Explore the Laravel CycleORM Starter Kit project: <ExternalLink href="https://github.com/wayofdev/laravel-cycle-starter-tpl">laravel-cycle-orm-starter-kit</ExternalLink>, based on Laravel 10.x. It showcases the practical use of the adapter in a real-world application, demonstrating how to leverage CycleORM's strengths within a Laravel project.

docs/pages/installation.mdx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import ExternalLink from "../components/external-link";
2+
13
# Installation
24

3-
Welcome to the installation guide for the Laravel Cycle ORM Adapter. This document will walk you through the setup process to get you up and running quickly.
5+
Welcome to the installation guide for the Laravel CycleORM Adapter. This document will walk you through the setup process to get you up and running quickly.
46

57
## 🚩 Prerequisites
68

@@ -11,15 +13,15 @@ Before you begin, ensure your development environment meets the following requir
1113

1214
## 🧩 Compatibility Map
1315

14-
| Laravel | Cycle ORM | Adapter |
15-
|---------|-----------|---------|
16-
| ^10.28 | 2.x | 4.x |
17-
| 11.x | 2.x | ^4.9.0 |
16+
| Laravel | CycleORM | Adapter |
17+
|---------|----------|---------|
18+
| ^10.28 | 2.x | 4.x |
19+
| 11.x | 2.x | ^4.9.0 |
1820

1921

2022
## 🚀 Quick Start
2123

22-
Installing the Laravel Cycle ORM Adapter is straightforward with Composer. Follow the steps below to add the adapter to your Laravel project.
24+
Installing the Laravel CycleORM Adapter is straightforward with Composer. Follow the steps below to add the adapter to your Laravel project.
2325

2426
<div className="steps-container">
2527

@@ -31,7 +33,7 @@ For the core functionality, run the following Composer command in your terminal:
3133
$ composer req wayofdev/laravel-cycle-orm-adapter
3234
```
3335

34-
This command installs the wayofdev/laravel-cycle-orm-adapter package, integrating Cycle ORM into your Laravel application.
36+
This command installs the wayofdev/laravel-cycle-orm-adapter package, integrating CycleORM into your Laravel application.
3537

3638
### Step: Publish Configuration
3739

@@ -46,10 +48,10 @@ $ php artisan vendor:publish \
4648

4749
## 🏭 Database Factories (Optional)
4850

49-
If you need support for [Eloquent-like Factories](https://laravel.com/docs/10.x/eloquent-factories), install the following package:
51+
If you need support for <ExternalLink href="https://laravel.com/docs/11.x/eloquent-factories">Eloquent-like Factories</ExternalLink>, install the following package:
5052

5153
```bash
5254
$ composer req --dev wayofdev/laravel-cycle-orm-factories
5355
```
5456

55-
which will install the [wayofdev/laravel-cycle-orm-factories](https://github.com/wayofdev/laravel-cycle-orm-factories) package to provide similar functionality
57+
which will install the <ExternalLink href="https://github.com/wayofdev/laravel-cycle-orm-factories">wayofdev/laravel-cycle-orm-factories</ExternalLink> package to provide similar functionality

0 commit comments

Comments
 (0)