Skip to content

Commit

Permalink
build: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi committed Mar 30, 2024
0 parents commit 16a9162
Show file tree
Hide file tree
Showing 154 changed files with 10,275 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .djlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"max_blank_lines": 2
}
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APP_SECRET=foo
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "composer" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
63 changes: 63 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Test

on:
push:
branches: [ "main", "test" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
test:

runs-on: ${{ matrix.operating-system }}

strategy:
matrix:
operating-system: [ubuntu-latest]
php: [ '8.1', '8.2', '8.3' ]
dep: [highest,lowest]

name: ${{ matrix.dep }} deps, PHP ${{ matrix.php }}, ${{ matrix.operating-system }}

steps:
- uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: intl

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dep }}
composer-options: --prefer-dist --no-progress

- name: Run psalm
run: vendor/bin/psalm
if: matrix.dep == 'highest'

- name: Run phpstan
run: vendor/bin/phpstan analyse
if: matrix.dep == 'highest'

- name: Run phpunit
run: |
vendor/bin/phpunit
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
composer.lock
vendor
.phpunit.cache
var
tools
.php-cs-fixer.cache
.vscode
4 changes: 4 additions & 0 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-cs-fixer" version="^3.42.0" installed="3.42.0" location="./tools/php-cs-fixer" copy="false"/>
</phive>
44 changes: 44 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/packages')
->in(__DIR__ . '/tests/src')
;

$config = new PhpCsFixer\Config();
return $config->setRules([
'@PSR12' => true,
'array_syntax' => ['syntax' => 'short'],

// imports
'fully_qualified_strict_types' => true,
'global_namespace_import' => [
'import_classes' => false,
'import_constants' => false,
'import_functions' => false,
],
'no_leading_import_slash' => true,
'no_unneeded_import_alias' => true,
'no_unused_imports' => true,
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => ['const', 'class', 'function']
],
'single_line_after_imports' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'declare_strict_types' => true,
'native_function_invocation' => ['include' => ['@compiler_optimized']],
'header_comment' => [
'header' => <<<EOF
This file is part of rekalogika/rekapager package.
(c) Priyadi Iman Nurcahyo <https://rekalogika.dev>
For the full copyright and license information, please view the LICENSE file
that was distributed with this source code.
EOF,
]
])
->setFinder($finder)
;
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 0.5.0

* build: initial commit
18 changes: 18 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Copyright (c) 2024-present Priyadi Iman Nurcahyo

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
71 changes: 71 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
PHP=php
COMPOSER=composer
SYMFONY=symfony

.PHONY: test
test: composer-dump lint monorepo-validate phpstan psalm phpunit

.PHONY: composer-dump
composer-dump:
$(COMPOSER) dump-autoload

.PHONY: phpstan
phpstan:
$(PHP) vendor/bin/phpstan analyse

.PHONY: psalm
psalm:
$(PHP) vendor/bin/psalm

.PHONY: phpunit
phpunit:
$(eval c ?=)
$(PHP) vendor/bin/phpunit $(c)

.PHONY: lint
lint:
$(PHP) tests/bin/console lint:container

.PHONY: php-cs-fixer
php-cs-fixer: tools/php-cs-fixer
$(PHP) $< fix --config=.php-cs-fixer.dist.php --verbose --allow-risky=yes

.PHONY: tools/php-cs-fixer
tools/php-cs-fixer:
phive install php-cs-fixer

.PHONY: doctrine
doctrine:
rm -f tests/var/data.db
$(PHP) tests/bin/console doctrine:schema:create
$(PHP) tests/bin/console doctrine:fixtures:load --no-interaction

.PHONY: serve
serve:
$(PHP) tests/bin/console cache:clear
$(PHP) tests/bin/console asset:install tests/public/
cd tests && sh -c "$(SYMFONY) server:start --document-root=public"

.PHONY: monorepo
monorepo: monorepo-validate monorepo-merge

.PHONY: monorepo-validate
monorepo-validate:
vendor/bin/monorepo-builder validate

.PHONY: merge
monorepo-merge:
$(PHP) vendor/bin/monorepo-builder merge

.PHONY: clean
clean:
rm -rf tests/var/cache/*
$(PHP) vendor/bin/psalm --clear-cache

.PHONY: sqlite
sqlite:
sqlite3 tests/var/data.db

.PHONY: dump
dump:
$(PHP) tests/bin/console server:dump
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# rekalogika/pager

A pagination library for PHP.
88 changes: 88 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"name": "rekalogika/rekapager",
"homepage": "https://rekalogika.dev/rekapager",
"license": "MIT",
"type": "library",
"authors": [
{
"name": "Priyadi Iman Nurcahyo",
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"Rekalogika\\Contracts\\Rekapager\\": "packages/rekapager-contracts/src/",
"Rekalogika\\Rekapager\\": "packages/rekapager-core/src/",
"Rekalogika\\Rekapager\\Doctrine\\Collections\\": "packages/rekapager-doctrine-collections-adapter/src/",
"Rekalogika\\Rekapager\\Doctrine\\ORM\\": "packages/rekapager-doctrine-orm-adapter/src/",
"Rekalogika\\Rekapager\\Keyset\\": "packages/rekapager-keyset-pagination/src/",
"Rekalogika\\Rekapager\\Offset\\": "packages/rekapager-offset-pagination/src/",
"Rekalogika\\Rekapager\\Symfony\\": "packages/rekapager-bundle/src/"
}
},
"autoload-dev": {
"psr-4": {
"Rekalogika\\Rekapager\\Tests\\": "tests/src/"
}
},
"require": {
"php": "^8.1",
"doctrine/collections": "^2.0",
"doctrine/orm": "^2.14 || ^3.0",
"psr/container": "^2.0",
"spomky-labs/base64url": "^2.0",
"symfony/config": "^6.4 || ^7.0",
"symfony/dependency-injection": "^6.4 || ^7.0",
"symfony/http-foundation": "^6.4 || ^7.0",
"symfony/http-kernel": "^6.4 || ^7.0",
"symfony/routing": "^6.4 || ^7.0",
"symfony/serializer": "^6.4 || ^7.0",
"twig/twig": "^3.5"
},
"require-dev": {
"bnf/phpstan-psr-container": "^1.0",
"doctrine/doctrine-bundle": "^2.11.3",
"doctrine/doctrine-fixtures-bundle": "^3.5",
"doctrine/persistence": "^3.1",
"ekino/phpstan-banned-code": "^1.0",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpstan/phpstan-phpunit": "^1.3",
"phpunit/phpunit": "^10.1",
"psalm/plugin-phpunit": "^0.18.4",
"psalm/plugin-symfony": "^5.1",
"ramsey/uuid": "^4.7",
"symfony/debug-bundle": "^6.4 || ^7.0",
"symfony/doctrine-bridge": "^6.4 || ^7.0",
"symfony/dotenv": "^6.4 || ^7.0",
"symfony/form": "^7.0",
"symfony/framework-bundle": "^6.4 || ^7.0",
"symfony/maker-bundle": "^1.55",
"symfony/monolog-bundle": "^3.0",
"symfony/runtime": "^6.4 || ^7.0",
"symfony/translation": "^6.4 || ^7.0",
"symfony/twig-bundle": "^6.4 || ^7.0",
"symfony/uid": "^6.4 || ^7.0",
"symfony/var-dumper": "^6.3 || ^7.0",
"symfony/web-profiler-bundle": "^6.4 || ^7.0",
"symfony/yaml": "^6.4 || ^7.0",
"symplify/monorepo-builder": "^11.2.20 || ^11.3",
"vimeo/psalm": "^5.15",
"zenstruck/foundry": "^1.36"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"symfony/runtime": true
}
},
"replace": {
"rekalogika/rekapager-bundle": "self.version",
"rekalogika/rekapager-contracts": "self.version",
"rekalogika/rekapager-core": "self.version",
"rekalogika/rekapager-doctrine-collections-adapter": "self.version",
"rekalogika/rekapager-doctrine-orm-adapter": "self.version",
"rekalogika/rekapager-keyset-pagination": "self.version",
"rekalogika/rekapager-offset-pagination": "self.version"
}
}
20 changes: 20 additions & 0 deletions monorepo-builder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

use Symplify\MonorepoBuilder\Config\MBConfig;
use Symplify\MonorepoBuilder\Release\ReleaseWorker\SetCurrentMutualDependenciesReleaseWorker;
use Symplify\MonorepoBuilder\Release\ReleaseWorker\UpdateBranchAliasReleaseWorker;
use Symplify\MonorepoBuilder\Release\ReleaseWorker\UpdateReplaceReleaseWorker;

return static function (MBConfig $mbConfig): void {
$mbConfig->packageDirectories([__DIR__ . '/packages']);
$mbConfig->defaultBranch('main');
$mbConfig->disableDefaultWorkers();

$mbConfig->workers([
UpdateReplaceReleaseWorker::class,
SetCurrentMutualDependenciesReleaseWorker::class,
UpdateBranchAliasReleaseWorker::class,
]);
};
3 changes: 3 additions & 0 deletions packages/rekapager-bundle/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# rekalogika/pager

A pagination library for PHP.
34 changes: 34 additions & 0 deletions packages/rekapager-bundle/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "rekalogika/rekapager-bundle",
"description": "",
"homepage": "https://rekalogika.dev/rekapager",
"keywords": [],
"license": "MIT",
"type": "symfony-bundle",
"authors": [
{
"name": "Priyadi Iman Nurcahyo",
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"Rekalogika\\Rekapager\\Symfony\\": "src/"
}
},
"require": {
"php": "^8.1",
"psr/container": "^2.0",
"rekalogika/rekapager-contracts": "^0.5",
"rekalogika/rekapager-core": "^0.5",
"rekalogika/rekapager-keyset-pagination": "^0.5",
"rekalogika/rekapager-offset-pagination": "^0.5",
"symfony/config": "^6.4 || ^7.0",
"symfony/dependency-injection": "^6.4 || ^7.0",
"symfony/http-foundation": "^6.4 || ^7.0",
"symfony/http-kernel": "^6.4 || ^7.0",
"symfony/routing": "^6.4 || ^7.0",
"symfony/serializer": "^6.4 || ^7.0",
"twig/twig": "^3.5"
}
}
Loading

0 comments on commit 16a9162

Please sign in to comment.