Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade package #1

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
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
26 changes: 26 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: PHPStan

on:
push:
paths:
- '**.php'
- 'phpstan.neon.dist'

jobs:
phpstan:
name: phpstan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none

- name: Install composer dependencies
uses: ramsey/composer-install@v3

- name: Run PHPStan
run: ./vendor/bin/phpstan --error-format=github
25 changes: 25 additions & 0 deletions .github/workflows/pint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Laravel Pint

on:
push:
paths:
- '**.php'

jobs:
pint:
name: pint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none

- name: Install composer dependencies
uses: ramsey/composer-install@v3

- name: Run pint
run: ./vendor/bin/pint --test
57 changes: 57 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Run Unit Tests

on:
pull_request:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: [8.0, 8.1, 8.2, 8.3]
laravel: [10.*, 11.*]
dependency-version: [prefer-lowest, prefer-stable]
exclude:
- laravel: 10.*
php: 8.0
- laravel: 11.*
php: 8.0
- laravel: 11.*
php: 8.1

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
key: php-${{ matrix.php }}-lara-${{ matrix.laravel }}-composer-${{ matrix.dependency-version }}-${{ hashFiles('**/composer.json') }}
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: php-${{ matrix.php }}-lara-${{ matrix.laravel }}-composer-${{ matrix.dependency-version }}-

- name: Install Composer dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction

- name: Run PHPUnit tests
run: vendor/bin/phpunit --testdox
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
build/
vendor/
composer.lock
composer.lock
*.cache
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ Run the following command from your projects root
```php
composer require norbybaru/modularize
```

For Laravel versions lower than 5.5, this step is important after running above script.
- Open your `config/app.php` file and add custom service provider:
```php
NorbyBaru\Modularize\ModularizeServiceProvider::class
## Config
Publish configuration
```bash
php artisan vendor:publish --provider="NorbyBaru\Modularize\ModularizeServiceProvider" --tag="modularize-config"
```

## Usage
Expand Down
36 changes: 30 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
"description": "Generate modular structure files for laravel",
"homepage": "https://github.com/norbybaru/modularize",
"keywords": ["laravel", "modular", "modules", "module", "structure", "modular", "laravel-modular", "modularize"],
"require": {
"php": ">=5.6.4",
"illuminate/support": "^5.6 || ^6.0 || ^7.0"
},
"license": "MIT",
"version": "1.2.2",
"version": "2.0",
"authors": [
{
"name": "Norby Baruani",
Expand All @@ -20,12 +16,40 @@
"NorbyBaru\\Modularize\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"NorbyBaru\\Modularize\\Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"providers": [
"NorbyBaru\\Modularize\\ModularizeServiceProvider"
]
}
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"analyse": "vendor/bin/phpstan analyse",
"fmt": "./vendor/bin/pint -v",
"post-autoload-dump": [
"@php vendor/bin/testbench package:discover --ansi"
],
"test": "phpunit"
},
"config": {
"sort-packages": true
},
"require": {
"php": "^8.1",
"illuminate/console": "^10.13|^11.0",
"illuminate/support": "^10.13|^11.0"
},
"require-dev": {
"laravel/pint": "^1.10",
"nunomaduro/larastan": "^2.0",
"orchestra/testbench": "^8.5|^9.0",
"phpunit/phpunit": "^9.5|^10.13|^11.0"
}
}
20 changes: 20 additions & 0 deletions config/modularize.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

return [

/**
* By enabling modular config, the package will autoload all modules found in the root_path directory
*/
'enable' => true,

/**
* Define application root directory folder to create modules files
*/
'root_path' => 'modules',

/**
* Routes created under the Routes/ directory of a module would be autoload to be discovered by the application.
* Setting 'autoload_routes => false' will require manually registering module routes through a service provider.
*/
'autoload_routes' => true,
];
16 changes: 16 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
includes:
- ./vendor/nunomaduro/larastan/extension.neon

parameters:

paths:
- src
- config

# The level 9 is the highest level
level: 5

tmpDir: build/phpstan
checkModelProperties: true
checkMissingIterableValueType: true
treatPhpDocTypesAsCertain: false
23 changes: 23 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
bootstrap="vendor/autoload.php"
colors="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
>
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_ENV" value="testing" force="true"/>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="DB_CONNECTION" value="testing"/>
</php>
</phpunit>
3 changes: 3 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"preset": "laravel"
}
Loading
Loading