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
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,44 @@
# AutoMapper
<h1 align="center">
<a href="https://github.com/jolicode/automapper"><img src="https://jolicode.com/media/original/oss/headers/automapper.png" alt="automapper"></a>
<br />
AutoMapper
<br />
<sub><em><h6>A blazing fast Data Mapper for PHP.</h6></em></sub>
</h1>

The AutoMapper solves a simple problem: removing all the code you need to map one object to another. A boring code to
<!-- Quelques badges optionnels, cool pour l'open source -->
<div align="center">

[![PHP Version Require](http://poser.pugx.org/jolicode/automapper/require/php)](https://packagist.org/packages/jolicode/automapper)<!-- Attention automapper -->
[![Monthly Downloads](http://poser.pugx.org/jolicode/automapper/d/monthly)](https://packagist.org/packages/jolicode/automapper)

</div>

The AutoMapper solves a simple problem: removing all the code you need to map one object to another. A boring code to
write and often replaced by less-performant alternatives like Symfony's Serializer.

## Quick Start 🚀

1. Install:

```shell
composer require jolicode/automapper
```

2. Use it:

```php
$mapper = AutoMapper::create();
$target = $mapper->map($data, Target::class);
```

You can read more about this library and how to use it on the [documentation](https://jolicode.github.io/automapper/).

## Support

For support, please create an issue on [Github tracker](https://github.com/jolicode/automapper/issues)

<br><br>
<div align="center">
<a href="https://jolicode.com/"><img src="https://jolicode.com/media/original/oss/footer-github.png?v3" alt="JoliCode is sponsoring this project"></a>
</div>
24 changes: 24 additions & 0 deletions castor.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
use Castor\Attribute\AsTask;

use function Castor\context;
use function Castor\http_download;
use function Castor\io;
use function Castor\PHPQa\php_cs_fixer;
use function Castor\PHPQa\phpstan;
use function Castor\run;
Expand Down Expand Up @@ -88,6 +90,28 @@ function doc_serve()
run('poetry run mkdocs serve -a localhost:8000');
}

#[AsTask(description: 'Fetch external assets and customize theme', namespace: 'doc')]
function build_assets(): void
{
io()->title('Fetching external assets for MkDocs documentation');

http_download('https://raw.githubusercontent.com/jolicode/oss-theme/refs/heads/main/MkDocs/extra.css', __DIR__ . '/docs/assets/stylesheets/jolicode.css');
http_download('https://raw.githubusercontent.com/jolicode/oss-theme/refs/heads/main/snippet-joli-footer.html', __DIR__ . '/docs/overrides/jolicode-footer.html');

$html = <<<'HTML'
AutoMapper is licensed under
<a href="https://github.com/jolicode/automapper/blob/main/LICENSE" target="_blank" rel="noreferrer noopener" class="jf-link">
MIT license
</a>
HTML;

$footer = file_get_contents(__DIR__ . '/docs/overrides/jolicode-footer.html');
$footer = str_replace('#GITHUB_REPO', 'jolicode/automapper', $footer);
$footer = str_replace('<!-- #SUBTITLE -->', $html, $footer);

file_put_contents(__DIR__ . '/docs/overrides/jolicode-footer.html', $footer);
}

#[AsTask('build-github-pages', namespace: 'doc', description: 'Serve documentation')]
function doc_build_github_pages()
{
Expand Down
90 changes: 90 additions & 0 deletions docs/assets/stylesheets/jolicode.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
:root > * {
--md-primary-color: #f7d325;
--md-typeset-a-color: #ea1340;
}

[data-md-color-scheme=slate][data-md-color-primary=black] {
--md-typeset-a-color: var(--md-primary-color);
}

@media screen and (min-width: 76.25em) {
.md-nav--primary {
position: relative;
padding-block: 0.6rem;
border: 1px solid var(--md-default-fg-color--lightest);
border-radius: 0.2rem;

.md-nav__list {
padding-bottom: 0;
}
}

.md-nav,
.md-nav--integrated > .md-nav__list > .md-nav__item--active .md-nav--secondary {
margin-bottom: 0;
}

.md-nav__toggle ~ .md-nav {
grid-template-rows: minmax(0, 0fr);
}

.md-nav__item .md-nav__link--active {
&::before {
content: "";
position: absolute;
left: 0;
width: 0.2rem;
height: 0.8rem;
background-color: var(--md-typeset-a-color);
}
}

.md-nav__item--active > .md-nav__link--active,
.md-nav__item--active > .md-nav__container > .md-nav__link--active {
&::before {
content: none;
}
}
}

.md-typeset {
h1 {
margin-bottom: 0.2em;
color: var(--md-default-fg-color);
font-weight: 400;
}

h2 {
font-weight: 400;
}

a {
text-decoration: underline;
}

blockquote {
color: var(--md-default-fg-color);
border: 1px solid var(--md-default-fg-color--lightest);

[dir=ltr] & {
border-left-color: var(--md-primary-color);
}

[dir=rtl] & {
border-right-color: var(--md-primary-color);
}

p {
margin-block: 0.4em;
}
}
}

[data-md-color-scheme=default] .hljs {
background-color: var(--md-default-fg-color--lightest);
}

/* Hide the existing social footer, ours is better */
.md-footer-meta.md-typeset {
display: none;
}
Loading