Skip to content

Commit ca95898

Browse files
Karim-AshrafKarim-Ashraf
authored andcommitted
Initial commit: LaraArchitect v1.0.0
0 parents  commit ca95898

94 files changed

Lines changed: 5365 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
* text=auto eol=lf
2+
3+
/.github export-ignore
4+
/docs export-ignore
5+
/tests export-ignore
6+
/.gitattributes export-ignore
7+
/.gitignore export-ignore
8+
/phpunit.xml export-ignore
9+
/phpstan.neon.dist export-ignore
10+
/pint.json export-ignore
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug Report
3+
about: Report a problem with LaraArchitect
4+
title: '[BUG] '
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Description
10+
11+
<!-- A clear and concise description of what the bug is -->
12+
13+
## Steps To Reproduce
14+
15+
<!-- If the bug involves the generator, include the exact `make:module` command and any relevant config -->
16+
17+
1.
18+
2.
19+
3.
20+
21+
## Expected Behavior
22+
23+
<!-- What you expected to happen -->
24+
25+
## Actual Behavior
26+
27+
<!-- What actually happened. Include error output / generated code if relevant -->
28+
29+
## Environment
30+
31+
- PHP Version:
32+
- Laravel Version:
33+
- LaraArchitect Version:
34+
- OS:
35+
36+
## Additional Context
37+
38+
<!-- Anything else that might help: published config, custom stubs, custom generators, ... -->
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an idea for LaraArchitect
4+
title: '[FEATURE] '
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
## Is your feature request related to a problem?
10+
11+
<!-- A clear and concise description of what the problem is -->
12+
13+
## Describe the solution you'd like
14+
15+
<!-- A clear and concise description of what you want to happen.
16+
For new patterns/generators, describe the files you'd expect `make:module` to produce -->
17+
18+
## Describe alternatives you've considered
19+
20+
<!-- Any alternative solutions or workarounds you've considered,
21+
e.g. a custom generator registered via config -->
22+
23+
## Additional context
24+
25+
<!-- Add any other context or code examples about the feature request here -->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## Description
2+
3+
<!-- Describe your changes in detail -->
4+
5+
## Motivation and Context
6+
7+
<!-- Why is this change required? What problem does it solve?
8+
Link related issues: Fixes #123 -->
9+
10+
## Type of Change
11+
12+
- [ ] Bug fix (non-breaking change)
13+
- [ ] New feature (non-breaking change)
14+
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
15+
- [ ] Documentation update
16+
17+
## How Has This Been Tested?
18+
19+
<!-- Describe the tests you added or ran -->
20+
21+
## Checklist
22+
23+
- [ ] `composer test` passes
24+
- [ ] `composer analyse` (PHPStan) passes
25+
- [ ] `composer format` (Pint) has been run
26+
- [ ] I have added tests covering my changes
27+
- [ ] I have updated `README.md` where behavior changed
28+
- [ ] I have added an entry under `[Unreleased]` in `CHANGELOG.md`

.github/workflows/tests.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php: ['8.2', '8.3', '8.4', '8.5']
17+
laravel: ['11.*', '12.*', '13.*']
18+
stability: [prefer-stable]
19+
include:
20+
- laravel: '11.*'
21+
testbench: '9.*'
22+
- laravel: '12.*'
23+
testbench: '10.*'
24+
- laravel: '13.*'
25+
testbench: '11.*'
26+
exclude:
27+
# Laravel 13 requires PHP 8.3+
28+
- laravel: '13.*'
29+
php: '8.2'
30+
# Laravel 11 supports PHP 8.2 - 8.4
31+
- laravel: '11.*'
32+
php: '8.5'
33+
34+
name: P${{ matrix.php }} - L${{ matrix.laravel }}
35+
36+
steps:
37+
- name: Checkout code
38+
uses: actions/checkout@v4
39+
40+
- name: Setup PHP
41+
uses: shivammathur/setup-php@v2
42+
with:
43+
php-version: ${{ matrix.php }}
44+
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, intl, iconv
45+
coverage: none
46+
47+
- name: Setup problem matchers
48+
run: |
49+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
50+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
51+
52+
- name: Install dependencies
53+
run: |
54+
composer require "illuminate/support:${{ matrix.laravel }}" --no-interaction --no-update
55+
composer require --dev "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
56+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
57+
58+
- name: Execute tests
59+
run: vendor/bin/phpunit --no-coverage
60+
61+
phpstan:
62+
runs-on: ubuntu-latest
63+
64+
name: PHPStan
65+
66+
steps:
67+
- name: Checkout code
68+
uses: actions/checkout@v4
69+
70+
- name: Setup PHP
71+
uses: shivammathur/setup-php@v2
72+
with:
73+
php-version: '8.3'
74+
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, intl, iconv
75+
coverage: none
76+
77+
- name: Install dependencies
78+
run: composer update --prefer-dist --no-interaction
79+
80+
- name: Run PHPStan
81+
run: vendor/bin/phpstan analyse --no-progress
82+
83+
pint:
84+
runs-on: ubuntu-latest
85+
86+
name: Pint
87+
88+
steps:
89+
- name: Checkout code
90+
uses: actions/checkout@v4
91+
92+
- name: Setup PHP
93+
uses: shivammathur/setup-php@v2
94+
with:
95+
php-version: '8.3'
96+
coverage: none
97+
98+
- name: Install dependencies
99+
run: composer update --prefer-dist --no-interaction
100+
101+
- name: Run Pint
102+
run: vendor/bin/pint --test

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/vendor/
2+
/coverage/
3+
composer.lock
4+
.phpunit.result.cache
5+
.phpunit.cache/
6+
.DS_Store

CHANGELOG.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Changelog
2+
3+
All notable changes to `lara-architect` will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
## [1.0.0] - 2026-07-21
11+
12+
### Added
13+
14+
- **Architecture building blocks**
15+
- `BaseService` with transactional CRUD, lifecycle hooks (`created`, `updated`, `deleted`, `restored`, `forceDeleted`) and repository delegation.
16+
- `BaseRepository` with full CRUD, eager loading, pagination and `getBy` criteria queries.
17+
- `BaseAction` for single-purpose, transaction-wrapped operations.
18+
- `BaseData` DTO with array/request hydration, backed-enum support and `toArray()` serialization.
19+
- Contracts (`Repository`, `CrudService`, `Action`) for container binding and swappable implementations.
20+
- **Soft-delete aware operations**
21+
- `deleteMany()`, `deleteAll()`, `restore()`, `restoreAll()`, `forceDelete()` and `trashed()` on repositories and services.
22+
- `SoftDeletesNotEnabledException` thrown when soft-delete operations are used on models without the `SoftDeletes` trait.
23+
- **Query filters**
24+
- `QueryFilter` base class mapping request query parameters to filter methods.
25+
- `Filterable` model trait providing a `filter()` scope.
26+
- `filter()` method on repositories and services returning paginated, filtered results.
27+
- **Module generator** (`php artisan make:module`)
28+
- Architecture presets: `service-repository`, `actions`, and custom presets via config.
29+
- Field definition syntax (`--fields="title:string, status:enum, price:decimal:nullable"`) driving migrations, validation, casts, factories and DTOs.
30+
- Generators for model, migration, factory, service, repository, action, DTO, controller, form requests, API resources, enums and query filters.
31+
- Publishable, customizable stubs.
32+
- **HTTP layer**
33+
- `BaseFormRequest` with a consistent JSON validation error envelope.
34+
- `RespondsWithJson` controller trait (`respondSuccess`, `respondCreated`, `respondDeleted`, `respondError`).
35+
- **Model concerns**: `HasUuid` trait with configurable UUID column.
36+
- **Enum support**: string-backed enum generation wired into model casts, `Rule::enum()` validation, factories and DTO property types.
37+
- `architect:patterns` command listing registered generators and presets.
38+
- Support for Laravel 11, 12 and 13 (PHP 8.2 – 8.5, per framework requirements).
39+
- Full test suite (PHPUnit via Orchestra Testbench), PHPStan level 5 (Larastan) and Laravel Pint.
40+
41+
[Unreleased]: https://github.com/karim-ashraf/lara-architect/compare/v1.0.0...HEAD
42+
[1.0.0]: https://github.com/karim-ashraf/lara-architect/releases/tag/v1.0.0

CONTRIBUTING.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Contributing to LaraArchitect
2+
3+
Thank you for considering contributing to LaraArchitect! Contributions of all kinds are welcome: bug reports, feature ideas, documentation improvements and pull requests.
4+
5+
## Reporting issues
6+
7+
Before opening an issue, please:
8+
9+
1. Search existing issues to avoid duplicates.
10+
2. Include the package version, Laravel version and PHP version.
11+
3. Provide a minimal reproduction — the `make:module` command you ran, the relevant config, and the actual vs. expected output.
12+
13+
For security vulnerabilities, please **do not** open a public issue. Email the maintainer instead.
14+
15+
## Development setup
16+
17+
```bash
18+
git clone https://github.com/karim-ashraf/lara-architect.git
19+
cd lara-architect
20+
composer install
21+
```
22+
23+
The test suite boots a full Laravel application through [Orchestra Testbench](https://github.com/orchestral/testbench), so no separate Laravel app is required.
24+
25+
## Before submitting a pull request
26+
27+
Run the full verification suite locally — CI runs the same three checks against every supported PHP/Laravel combination:
28+
29+
```bash
30+
composer test # PHPUnit (unit + feature tests)
31+
composer analyse # PHPStan level 5 (Larastan)
32+
composer format # Laravel Pint (code style)
33+
```
34+
35+
All three must pass. A few guidelines:
36+
37+
- **Add tests.** New features need feature or unit tests; bug fixes need a regression test that fails without the fix.
38+
- **Keep PRs focused.** One feature or fix per pull request makes review faster.
39+
- **Follow the existing style.** Pint enforces formatting; PHPStan enforces type safety. New public methods should carry proper generics/docblocks where Eloquent types are involved.
40+
- **Update documentation.** If you change behavior or add a feature, update `README.md` and add an entry under `[Unreleased]` in `CHANGELOG.md`.
41+
- **Stubs and generators.** When adding a new pattern generator, register it in `config/lara-architect.php`, add its stub under `stubs/`, and cover it in `tests/Feature/MakeModuleCommandTest.php`.
42+
43+
## Commit messages
44+
45+
Use clear, imperative commit messages (e.g. `Add restoreAll support to BaseRepository`). Reference related issues where applicable (`Fixes #12`).
46+
47+
## Branching
48+
49+
- Create feature branches from `main`.
50+
- Target pull requests at `main`.
51+
52+
## Code of conduct
53+
54+
Be respectful and constructive. We want this to be a welcoming project for everyone.

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# The MIT License (MIT)
2+
3+
Copyright (c) 2026 Karim Ashraf
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

0 commit comments

Comments
 (0)