diff --git a/README.md b/README.md index aa3349cd..ccac1a93 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,44 @@ -# AutoMapper +

+ automapper +
+ AutoMapper +
+
A blazing fast Data Mapper for PHP.
+

-The AutoMapper solves a simple problem: removing all the code you need to map one object to another. A boring code to + +
+ +[![PHP Version Require](http://poser.pugx.org/jolicode/automapper/require/php)](https://packagist.org/packages/jolicode/automapper) +[![Monthly Downloads](http://poser.pugx.org/jolicode/automapper/d/monthly)](https://packagist.org/packages/jolicode/automapper) + +
+ +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) + +

+
+JoliCode is sponsoring this project +
diff --git a/castor.php b/castor.php index 707f504e..52d8ea10 100644 --- a/castor.php +++ b/castor.php @@ -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; @@ -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 + + MIT license + + HTML; + + $footer = file_get_contents(__DIR__ . '/docs/overrides/jolicode-footer.html'); + $footer = str_replace('#GITHUB_REPO', 'jolicode/automapper', $footer); + $footer = str_replace('', $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() { diff --git a/docs/assets/stylesheets/jolicode.css b/docs/assets/stylesheets/jolicode.css new file mode 100644 index 00000000..24f65068 --- /dev/null +++ b/docs/assets/stylesheets/jolicode.css @@ -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; +} diff --git a/docs/overrides/jolicode-footer.html b/docs/overrides/jolicode-footer.html new file mode 100644 index 00000000..7765bcae --- /dev/null +++ b/docs/overrides/jolicode-footer.html @@ -0,0 +1,383 @@ + diff --git a/docs/overrides/main.html b/docs/overrides/main.html index 0a290dff..46eb66e2 100644 --- a/docs/overrides/main.html +++ b/docs/overrides/main.html @@ -8,4 +8,9 @@ {% else %} {{ config.site_name }} {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} + +{% block footer %} +{{ super() }} +{% include "jolicode-footer.html" %} +{% endblock %} diff --git a/mkdocs.yaml b/mkdocs.yaml index 10a9d700..1221635c 100644 --- a/mkdocs.yaml +++ b/mkdocs.yaml @@ -88,4 +88,5 @@ plugins: extra_javascript: - assets/javascripts/highlight.min.js extra_css: - - assets/stylesheets/highlight-github.min.css \ No newline at end of file + - assets/stylesheets/highlight-github.min.css + - assets/stylesheets/jolicode.css \ No newline at end of file