Skip to content

Commit 3028fbf

Browse files
Merge pull request #1 from karam-mustafa/main
Update package files
2 parents ceefcc6 + ffda13b commit 3028fbf

File tree

6 files changed

+137
-14
lines changed

6 files changed

+137
-14
lines changed

.github/workflows/php-cs-fixer.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Check & fix styling
2+
3+
on: [push,pull_request]
4+
5+
jobs:
6+
php-cs-fixer:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v2
12+
with:
13+
ref: ${{ github.head_ref }}
14+
15+
- name: Run PHP Code Style Fixer
16+
uses: docker://oskarstark/php-cs-fixer-ga
17+
with:
18+
args: --config=.php-cs-fixer.dist.php --allow-risky=yes
19+
20+
- name: Commit changes
21+
uses: stefanzweifel/git-auto-commit-action@v4
22+
with:
23+
commit_message: Fix styling

.github/workflows/php.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: PHP Composer
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Validate composer.json and composer.lock
18+
run: composer validate --strict
19+
20+
- name: Cache Composer packages
21+
id: composer-cache
22+
uses: actions/cache@v2
23+
with:
24+
path: vendor
25+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
26+
restore-keys: |
27+
${{ runner.os }}-php-
28+
- name: Install dependencies
29+
run: composer install --prefer-dist --no-progress
30+
31+
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
32+
# Docs: https://getcomposer.org/doc/articles/scripts.md
33+
34+
# - name: Run test suite
35+
# run: composer run-script test

.github/workflows/tests.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Run tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
os: [ubuntu-latest]
12+
php: [7.4, 8.0]
13+
laravel: [8.*,7.*]
14+
dependency-version: [prefer-stable]
15+
include:
16+
- testbench: ^6.23
17+
laravel: 8.*
18+
19+
- testbench: 5.20
20+
laravel: 7.*
21+
22+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v2
27+
28+
- name: Setup PHP
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: ${{ matrix.php }}
32+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
33+
coverage: none
34+
35+
- name: Install dependencies
36+
run: |
37+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
38+
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
39+
- name: Execute tests
40+
run: vendor/bin/phpunit
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Update Changelog"
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
jobs:
8+
update:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
with:
15+
ref: main
16+
17+
- name: Update Changelog
18+
uses: stefanzweifel/changelog-updater-action@v1
19+
with:
20+
latest-version: ${{ github.event.release.name }}
21+
release-notes: ${{ github.event.release.body }}
22+
23+
- name: Commit updated CHANGELOG
24+
uses: stefanzweifel/git-auto-commit-action@v4
25+
with:
26+
branch: main
27+
commit_message: Update CHANGELOG
28+
file_pattern: CHANGELOG.md

README.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
![logo](assets/logo.png)
22

3-
#Add your package badges
43

5-
[![PHP Composer](https://github.com/Syrian-Open-Source/laravel-package-template/actions/workflows/php.yml/badge.svg)](https://github.com/syrian-open-source/laravel-multi-process/actions/workflows/php.yml)
6-
[![Run tests](https://github.com/Syrian-Open-Source/laravel-package-template/actions/workflows/tests.yml/badge.svg)](https://github.com/syrian-open-source/laravel-multi-process/actions/workflows/tests.yml)
4+
[![PHP Composer](https://github.com/Syrian-Open-Source/laravel-relational-metrics/actions/workflows/php.yml/badge.svg)](https://github.com/syrian-open-source/laravel-multi-process/actions/workflows/php.yml)
5+
[![Run tests](https://github.com/Syrian-Open-Source/laravel-relational-metrics/actions/workflows/tests.yml/badge.svg)](https://github.com/syrian-open-source/laravel-multi-process/actions/workflows/tests.yml)
76

8-
Design a simple and expressive logo with the same model you see above,
9-
the logo design helps to unify the visual identity and further develop the optimal packages to increase the quality of the software we develop
107

118
# Relational Metrics
129
This package will help you to make your metrics easier, You could get metrics about your Models, Models depending on their relations, or even metrics about your models depending on multiple conditions!!
@@ -17,16 +14,16 @@ It would be a very easy to get the number of your stores which has products has
1714
The first step is using composer to install the package and automatically update your composer.json file, you can do this by running:
1815

1916
```shell
20-
composer require syrian-open-source/relational-metrics
17+
composer require syrian-open-source/laravel-relational-metrics
2118
```
2219

2320

2421
Usage
2522
---------
26-
The Basic Usage of this package is the same of geting count of some model instances, but with a styled response
23+
The Basic Usage of this package is the same of getting count of some model instances, but with a styled response
2724

2825
```php
29-
$instance = (new RelationalMetrics(ModelName));
26+
$instance = (new \SOS\RelationalMetrics\Classes\RelationalMetrics(ModelName));
3027
// EX: new RelationalMetrics(Store);
3128
$metrics = $instance->getBasicMetrics();
3229
/*
@@ -43,7 +40,7 @@ What you can do next, you could get the metrics of a model depending on one of i
4340
Let's assume we want to get the number of stores that has products with price more than 500
4441

4542
```php
46-
$instance = (new RelationalMetrics(ModelName));
43+
$instance = (new \SOS\RelationalMetrics\Classes\RelationalMetrics(ModelName));
4744
// EX: new RelationalMetrics(Store);
4845
$metrics = $instance->getRelationalMetrics($relationName, $relationColumn, $value);
4946
// EX: $instance->getRelationalMetrics('products, 'price', 500);
@@ -63,7 +60,7 @@ And last but not least, You could get the metrics about a model depending on any
6360

6461

6562
```php
66-
$instance = (new RelationalMetrics(ModelName));
63+
$instance = (new \SOS\RelationalMetrics\Classes\RelationalMetrics(ModelName));
6764
// EX: new RelationalMetrics(Store);
6865
$metrics = $instance->getRelationalMetrics($conditions);
6966
// EX: $instance->getRelationalMetrics(
@@ -87,15 +84,15 @@ At the previous Example the Package will return the number of the stores where t
8784

8885
Changelog
8986
---------
90-
Please see the [CHANGELOG](https://github.com/syrian-open-source/laravel-package-template/blob/master/CHANGELOG.md) for more information about what has changed or updated or added recently.
87+
Please see the [CHANGELOG](https://github.com/syrian-open-source/laravel-relational-metrics/blob/master/CHANGELOG.md) for more information about what has changed or updated or added recently.
9188

9289
Security
9390
--------
94-
If you discover any security related issues, please email them first to "your email",
91+
If you discover any security related issues, please email them first to "zainaldeenfayod@gmail.com",
9592
if we do not fix it within a short period of time please open a new issue describing your problem.
9693

9794
Credits
9895
-------
9996
* [zainaldeenfayod@gmail.com](https://github.com/zainaldeen/laravel-relational-metrics-1)
100-
* [All contributors](https://github.com/syrian-open-source/laravel-package-template/graphs/contributors)
97+
* [All contributors](https://github.com/syrian-open-source/laravel-relational-metrics/graphs/contributors)
10198

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "syrian-open-source/relational-metrics",
2+
"name": "syrian-open-source/laravel-relational-metrics",
33
"description": "This package will help you to get your model metrics, and their related models' metrics which will help you to avoid writing to many requests or queries.",
44
"license": "MIT",
55
"keywords": [

0 commit comments

Comments
 (0)