Skip to content

Commit 7b609ad

Browse files
committed
docs: refresh readme
1 parent 87d52ec commit 7b609ad

1 file changed

Lines changed: 25 additions & 104 deletions

File tree

README.md

Lines changed: 25 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,14 @@
1212

1313
<div align="center">
1414

15-
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fcycle%2Factive-record%2Fbadge&style=flat-square&label=github%20actions)](https://github.com/cycle/active-record/actions)
16-
[![Total Downloads](https://img.shields.io/packagist/dt/cycle/active-record?&style=flat-square)](https://packagist.org/packages/cycle/active-record)
17-
[![Latest Stable Version](https://img.shields.io/packagist/v/cycle/active-record?&style=flat-square)](https://packagist.org/packages/cycle/active-record)
18-
[![Commits since latest release](https://img.shields.io/github/commits-since/cycle/active-record/latest?style=flat-square)](https://packagist.org/packages/cycle/active-record)
19-
[![PHP Version Require](https://poser.pugx.org/cycle/active-record/require/php?style=flat-square)](https://packagist.org/packages/cycle/active-record)
2015
[![Codecov Coverage](https://img.shields.io/codecov/c/github/cycle/active-record?style=flat-square&logo=codecov)](https://app.codecov.io/gh/cycle/active-record)
2116
[![Type Coverage](https://shepherd.dev/github/cycle/active-record/coverage.svg)](https://shepherd.dev/github/cycle/active-record)
2217
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat-square&label=mutation%20score&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fcycle%2Factive-record%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/cycle/active-record/master)
2318
[![Discord](https://img.shields.io/discord/538114875570913290?style=flat-square&logo=discord&labelColor=7289d9&logoColor=white&color=39456d)](https://discord.gg/spiralphp)
2419
[![Follow on Twitter (X)](https://img.shields.io/badge/-Follow-black?style=flat-square&logo=X)](https://x.com/intent/follow?screen_name=SpiralPHP)
2520

21+
[//]: # ([![Commits since latest release]&#40;https://img.shields.io/github/commits-since/cycle/active-record/latest?style=flat-square&#41;]&#40;https://packagist.org/packages/cycle/active-record&#41;)
22+
2623
</div>
2724

2825
# Active Record Implementation for Cycle ORM
@@ -39,7 +36,7 @@ This allows for more straightforward and rapid development cycles, particularly
3936

4037
Before you begin, ensure your development environment meets the following requirements:
4138

42-
- **PHP Version:** 8.2 or higher
39+
- **PHP Version:** 8.1 or higher
4340
- One of the Cycle ORM adapters:
4441
- [`spiral/cycle-bridge`](https://github.com/spiral/cycle-bridge) official Cycle ORM adapter for the [Spiral Framework](https://github.com/spiral/framework)
4542
- [`yiisoft/yii-cycle`](https://github.com/yiisoft/yii-cycle) — official Cycle ORM adapter for the [Yii 3](https://www.yiiframework.com)
@@ -55,6 +52,11 @@ The preferred way to install this package is through [Composer](https://getcompo
5552
composer require cycle/active-record
5653
```
5754

55+
[![PHP Version Require](https://poser.pugx.org/cycle/active-record/require/php?style=flat-square)](https://packagist.org/packages/cycle/active-record)
56+
[![Latest Stable Version](https://img.shields.io/packagist/v/cycle/active-record?&style=flat-square)](https://packagist.org/packages/cycle/active-record)
57+
[![License](https://img.shields.io/packagist/l/cycle/active-record.svg?style=flat-square)](LICENSE.md)
58+
[![Total Downloads](https://img.shields.io/packagist/dt/cycle/active-record?&style=flat-square)](https://packagist.org/packages/cycle/active-record)
59+
5860
After package install you need to, optionally, register bootloader / service-provider in your application.
5961

6062
### → Spiral Framework
@@ -80,15 +82,15 @@ class Kernel extends \Spiral\Framework\Kernel
8082
{
8183
return [
8284
// ...
83-
85+
8486
// ORM
8587
CycleBridge\SchemaBootloader::class,
8688
CycleBridge\CycleOrmBootloader::class,
8789
CycleBridge\AnnotatedBootloader::class,
88-
90+
8991
// ActiveRecord
9092
ActiveRecordBootloader::class,
91-
93+
9294
// ...
9395
];
9496
}
@@ -98,7 +100,7 @@ For more information about bootloaders, refer to the [Spiral Framework documenta
98100

99101
### → Laravel
100102

101-
> [!NOTE]
103+
> [!NOTE]
102104
> If you are using Laravel, then you don't need to register service-provider by yourself. It will be registered automatically.
103105
104106
### → Yii 3
@@ -115,8 +117,8 @@ This package uses [PSR-11](https://www.php-fig.org/psr/psr-11/) compatible `cont
115117

116118
## 📖 Usage
117119

118-
> [!NOTE]
119-
> For detailed usage instructions, refer to the [documentation](/docs/README.md).
120+
> [!NOTE]
121+
> For detailed usage instructions, refer to the [documentation][Documentation].
120122
121123
### → Basic Example
122124

@@ -131,93 +133,25 @@ use Cycle\Annotated\Annotation\Entity;
131133
class User extends ActiveRecord
132134
{
133135
#[Column(type: 'primary', typecast: 'int')]
134-
private int $id;
136+
public ?int $id = null;
135137

136-
#[Column(type: 'string')]
137-
private string $name;
138+
#[Column(type: 'string')]
139+
public string $name;
138140

139-
public function __construct(string $name)
140-
{
141-
$this->name = $name;
142-
}
143-
144-
public function id(): int
145-
{
146-
return $this->id;
147-
}
148-
149-
public function name()
141+
public function create(string $name)
150142
{
151-
return $this->name;
143+
return self::make([
144+
'name' => $name,
145+
]);
152146
}
153147
}
154148
```
155149

156150
#### Create a new record
157151

158152
```php
159-
$user = new User(name: 'John');
160-
$user->save();
161-
```
162-
163-
<br>
164-
165-
## 🧪 Running Tests
166-
167-
### → PHPUnit tests
168-
169-
To run tests, run the following command:
170-
171-
```bash
172-
make test
173-
```
174-
175-
### → Mutation tests
176-
177-
To run mutation tests, using [`infection/infection`](https://github.com/infection/infection):
178-
179-
```bash
180-
make infect
181-
```
182-
183-
### → Static Analysis
184-
185-
Code quality using Psalm:
186-
187-
```bash
188-
make lint-psalm
189-
```
190-
191-
### → Coding Standards Fixing
192-
193-
Fix code using The PHP Coding Standards Fixer (PHP CS Fixer) to follow our standards:
194-
195-
```bash
196-
make lint-php
197-
```
198-
199-
### → Lint Yaml files
200-
201-
Lint all yaml files in project:
202-
203-
```bash
204-
make lint-yaml
205-
```
206-
207-
### → Lint Markdown files
208-
209-
Lint all yaml files in project:
210-
211-
```bash
212-
make lint-md
213-
```
214-
215-
### → Lint GitHub Actions
216-
217-
Lint all yaml files in project:
218-
219-
```bash
220-
make lint-actions
153+
$user = User::create(name: 'John');
154+
$user->saveOrFail();
221155
```
222156

223157
<br>
@@ -240,27 +174,14 @@ Thank you for considering contributing to the cycle community! We are open to al
240174
You are more than welcome. Before contributing, kindly check our [contribution guidelines](.github/CONTRIBUTING.md).
241175

242176
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=for-the-badge)](https://conventionalcommits.org)
177+
[![Contributors](https://img.shields.io/github/contributors/cycle/active-record?style=for-the-badge)](https://github.com/cycle/active-record/graphs/contributors)
243178

244179
<br>
245180

246-
## 🫡 Contributors
247-
248-
<a href="https://github.com/cycle/active-record/graphs/contributors">
249-
<img align="left" src="https://img.shields.io/github/contributors-anon/cycle/active-record?style=for-the-badge" alt="Contributors Badge"/>
250-
</a>
251-
252-
<br>
253-
<br>
254-
255181
## 🌐 Social Links
256182

257183
- **Twitter:** Follow our organization [@SpiralPHP](https://twitter.com/intent/follow?screen_name=spiralphp).
258184
- **Discord:** Join our community on [Discord](https://discord.gg/SpiralPHP).
259185

260-
<br>
261-
262-
## ⚖️ License
263186

264-
[![Licence](https://img.shields.io/github/license/wayofdev/active-record?style=for-the-badge&color=blue)](./LICENSE.md)
265-
266-
<br>
187+
[Documentation]: https://cycle-orm.dev/docs/active-record-introduction/

0 commit comments

Comments
 (0)