Skip to content

Commit

Permalink
Merge pull request #741 from apiato/refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammad-Alavi committed Feb 5, 2024
2 parents 3609422 + 15d364e commit ac2eb90
Show file tree
Hide file tree
Showing 648 changed files with 17,280 additions and 10,367 deletions.
96 changes: 10 additions & 86 deletions .env.ci
Original file line number Diff line number Diff line change
@@ -1,96 +1,20 @@
APP_NAME="apiato"
APP_ENV=local
APP_ENV=ci
APP_KEY=
APP_URL=http://apiato.test
API_URL=http://api.apiato.test
API_PREFIX=/

APP_DEBUG=true
API_DEBUG=true
DEBUGBAR_ENABLED=false
API_DEBUG=false

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

HASH_ID=true
HASH_ID_KEY=apiato
HASH_ID_LENGTH=16

GLOBAL_API_RATE_LIMIT_ENABLED=true
GLOBAL_API_RATE_LIMIT_ATTEMPTS_PER_MIN=30
GLOBAL_API_RATE_LIMIT_EXPIRES_IN_MIN=1

PAGINATION_LIMIT_DEFAULT=10
PAGINATION_SKIP=false

API_TOKEN_EXPIRES=1440
API_REFRESH_TOKEN_EXPIRES=43200
API_ENABLE_IMPLICIT_GRANT=true
HASH_ID_LENGTH=4

REQUIRE_EMAIL_VERIFICATION=false
EMAIL_VERIFICATION_LINK_EXPIRATION_TIME_IN_MINUTE=30

ELOQUENT_QUERY_CACHE=false
ELOQUENT_QUERY_CACHE_TIME=60

SRC_PATH=app

ROOT_NAMESPACE=App\
USER_NAMESPACE=App\Containers\AppSection\User\Models\
ADMIN_ROLE=admin

DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_CONNECTION=pgsql
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=test
DB_USERNAME=root
DB_PASSWORD=password

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=log
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1

VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

CLIENT_WEB_ID=
CLIENT_WEB_SECRET=
DB_USERNAME=postgres
DB_PASSWORD=postgres

CLIENT_MOBILE_ID=
CLIENT_MOBILE_SECRET=
PASSPORT_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\\nMIIJKgIBAAKCAgEAv6s9sNcaJW+yq0VmvAJVRLcspSLXGbm5e9IsNYA5gwyD2HJe+15Yk0xtkdrJvFZJdZ9NgaBKthsjJiDwrD574KEJR1ZzlohkjtWyY3dp+tYs06oQvRBGWeLok4x8iZeG1EDcL6cYiM56pT2tCFd5E/7t0LhGf14SKoBnEqM3Kl+TVNQr9mXmsRh9Xqy/KgqvscXpQUa/q35MbNJ6ztj8DPLhLwN9Lu2nX7TCgPdaakCQjeHOpcNNiR4cDN8DbOF3l0WVi4IVyrCM+7SVE0B9bWSCr31/yDgFzn/+o6LB743mOBLb7VDwuiQyIra1BNt5w1w+rmJCd0uu+Ux2+36pxxnQMXtfPuzCPt/qTo8CV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ekracIEMiELKxZYvh+TahMYTTbnu+Xmo5/btnt3iNNYW/z2MAXGcStIPek8zCKHhAN1DCe96T6SzHgC8Rw1v3zRTfLGm1IPINr4hB5qiISLg6jhBHH1UqoPzKvCMPQ9UkBvey5IJBGAaubpTKsaWoG0HWdi/34EW7ba/G2h45bVaXbSIOBzOXrRDZYUqbCimsEe4xi/yMsYJAyW9rRhxs5R15uS43MlXvwV7oBagxbk+r2aw3JJeWBfJa0UJbjh1kX5rH3BsVkONeJBsfcLC6nwkePSfaDa5MEA9E4S0uJMODlJ6jhdwUrUCAwEAAQ==\\n-----END PUBLIC KEY-----\\n"
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ APP_URL=http://apiato.test
API_URL=http://api.apiato.test
API_PREFIX=/

APP_DEBUG=true
API_DEBUG=true
APP_DEBUG=false
API_DEBUG=false
DEBUGBAR_ENABLED=false

LOG_CHANNEL=stack
Expand Down
17 changes: 14 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* text=auto eol=lf
* text=auto

*.blade.php diff=html
*.css diff=css
Expand All @@ -7,5 +7,16 @@
*.php diff=php

/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
/tests export-ignore
.env.ci export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php-cs-fixer.dist.php export-ignore
CODE_OF_CONDUCT.md export-ignore
composer.lock export-ignore
CONTRIBUTING.md export-ignore
package-lock.json export-ignore
phpunit.xml export-ignore
psalm.xml export-ignore
ruleset.xml export-ignore
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/Bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ body:
- type: textarea
attributes:
label: Steps To Reproduce
description: Provide detailed steps to reproduce your issue. If necessary, please provide a GitHub repository to demonstrate your issue using `Apiato new bug-report --github="--public"`.
description: Provide detailed steps to reproduce your issue. If necessary, please provide a GitHub repository to demonstrate your issue.
validations:
required: true

3 changes: 2 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
[//]: # (Please put an x in the box that apply.)

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] Refactor (refactoring a current feature, method, etc.)
- [ ] Refactor (refactoring a current feature, method, etc...)
- [ ] Code Coverage (adding/removing/updating/refactoring tests)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Remove feature (non-breaking change which removes functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
on: [push, pull_request]
name: Check & fix styling

on:
pull_request:
types: [ opened, synchronize, reopened ]

jobs:
php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
permissions:
contents: write
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
uses: actions/checkout@v4
- name: Use Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .php-cs-fixer.cache
key: ${{ runner.OS }}-${{ github.repository }}-phpcsfixer-${{ github.sha }}
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Tests

on:
push:
branches:
- master
- '*.x'
pull_request:

permissions:
contents: read

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [ 8.1, 8.2 ]
name: PHP ${{ matrix.php }}
timeout-minutes: 10
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
coverage: xdebug
tools: phpunit:10.x

- name: Setup Composer token
run: composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}

# If you encounter an error during Laravel package discovery, remember this:
# Composer doesn't have access to env variables at this stage,
# Therefore, it uses the default value for all env variables.
# To fix this, we need to copy the .env.ci file to .env before running composer install.
- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction --no-progress

- name: Copy environment file
run: cp .env.ci .env

- name: Generate app key
run: php artisan key:generate

- name: Execute tests
run: vendor/bin/phpunit --coverage-clover=coverage.xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
41 changes: 0 additions & 41 deletions .github/workflows/tests.yml

This file was deleted.

14 changes: 12 additions & 2 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
->in([
__DIR__ . '/app',
])
->name('*.php')
->notName('*.blade.php')
->exclude('Containers/Vendor');
->exclude('Containers/Vendor')
->notName('_*');

return (new PhpCsFixer\Config())
->setRules([
Expand All @@ -19,6 +21,14 @@
'phpdoc_align' => [
'align' => 'left',
],
'phpdoc_to_comment' => false,
'trailing_comma_in_multiline' => [
'elements' => ['arguments', 'arrays', 'match', 'parameters'],
],
'blank_line_before_statement' => [
'statements' => ['return', 'throw', 'try'],
],
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true],
'nullable_type_declaration' => ['syntax' => 'union'],

])
->setFinder($finder);
29 changes: 21 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
<p align="center">
<img src="https://github.com/apiato/documentation/blob/master/images/apiato.jpg" alt="Apiato Logo"/>
<a href="https://github.com/apiato/apiato/actions/workflows/tests.yaml">
<img src="https://img.shields.io/github/actions/workflow/status/apiato/apiato/tests.yaml?label=tests" alt="tests status">
</a>
<a href="https://codecov.io/gh/apiato/apiato" >
<img src="https://img.shields.io/codecov/c/github/apiato/apiato?token=siiyEg5AC9" alt="code coverage"/>
</a>
<a href="https://packagist.org/packages/apiato/apiato">
<img src="https://img.shields.io/packagist/v/apiato/apiato" alt="latest stable version">
</a>
<br>
<a href="https://packagist.org/packages/apiato/apiato">
<img src="https://img.shields.io/packagist/dt/apiato/apiato" alt="total downloads">
</a>
<a href="https://github.com/apiato/apiato">
<img src="https://img.shields.io/github/license/apiato/apiato" alt="license">
</a>
<a href="https://discord.gg/ryPcV4KM5k">
<img src="https://img.shields.io/discord/800815227839053834?logo=discord&label=chat" alt="chat">
</a>
</p>

<h3 align="center">Build scalable API's faster | With PHP 8.0 and Laravel 10.0</h3>

[//]: # (<a href="https://github.com/apiato/apiato/actions"><img src="https://github.com/apiato/apiato/workflows/Tests/badge.svg" alt="Build Status"></a>)
<p align="center">
<a href="https://packagist.org/packages/apiato/apiato"><img src="https://img.shields.io/packagist/dt/apiato/apiato" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/apiato/apiato"><img src="https://img.shields.io/packagist/v/apiato/apiato" alt="Latest Stable Version"></a>
<a href="https://github.com/apiato/apiato"><img src="https://img.shields.io/github/license/apiato/apiato" alt="License"></a>
<a href="https://discord.gg/ryPcV4KM5k"><img src="https://img.shields.io/discord/800815227839053834?label=discord" alt="support"></a>
<img src="https://github.com/apiato/documentation/blob/master/images/apiato.jpg" alt="Apiato Logo"/>
</p>
<h3 align="center">Build scalable API's faster | With PHP 8.0 and Laravel 10.0</h3>

## About Apiato

Expand Down

0 comments on commit ac2eb90

Please sign in to comment.