generated from CodeWithDennis/larament
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d69306b
Showing
104 changed files
with
18,004 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
indent_size = 2 | ||
|
||
[docker-compose.yml] | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
APP_NAME=Larament | ||
APP_ENV=local | ||
APP_KEY= | ||
APP_DEBUG=true | ||
APP_TIMEZONE=UTC | ||
APP_URL=http://localhost | ||
|
||
APP_LOCALE=en | ||
APP_FALLBACK_LOCALE=en | ||
APP_FAKER_LOCALE=en_US | ||
|
||
APP_MAINTENANCE_DRIVER=file | ||
# APP_MAINTENANCE_STORE=database | ||
|
||
BCRYPT_ROUNDS=12 | ||
|
||
LOG_CHANNEL=stack | ||
LOG_STACK=single | ||
LOG_DEPRECATIONS_CHANNEL=null | ||
LOG_LEVEL=debug | ||
|
||
DB_CONNECTION=sqlite | ||
# DB_HOST=127.0.0.1 | ||
# DB_PORT=3306 | ||
# DB_DATABASE=larament_boilerplate | ||
# DB_USERNAME=root | ||
# DB_PASSWORD= | ||
|
||
SESSION_DRIVER=database | ||
SESSION_LIFETIME=120 | ||
SESSION_ENCRYPT=false | ||
SESSION_PATH=/ | ||
SESSION_DOMAIN=null | ||
|
||
BROADCAST_CONNECTION=log | ||
FILESYSTEM_DISK=local | ||
QUEUE_CONNECTION=database | ||
|
||
CACHE_STORE=database | ||
CACHE_PREFIX= | ||
|
||
MEMCACHED_HOST=127.0.0.1 | ||
|
||
REDIS_CLIENT=phpredis | ||
REDIS_HOST=127.0.0.1 | ||
REDIS_PASSWORD=null | ||
REDIS_PORT=6379 | ||
|
||
MAIL_MAILER=log | ||
MAIL_HOST=127.0.0.1 | ||
MAIL_PORT=2525 | ||
MAIL_USERNAME=null | ||
MAIL_PASSWORD=null | ||
MAIL_ENCRYPTION=null | ||
MAIL_FROM_ADDRESS="[email protected]" | ||
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 | ||
|
||
VITE_APP_NAME="${APP_NAME}" | ||
|
||
DEBUGBAR_ENABLED=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
* text=auto eol=lf | ||
|
||
*.blade.php diff=html | ||
*.css diff=css | ||
*.html diff=html | ||
*.md diff=markdown | ||
*.php diff=php | ||
|
||
/.github export-ignore | ||
CHANGELOG.md export-ignore | ||
.styleci.yml export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Tests | ||
|
||
on: [ push ] | ||
|
||
jobs: | ||
tests: | ||
name: Application Operational Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Start MYSQL | ||
run: | | ||
sudo systemctl enable mysql.service | ||
sudo systemctl start mysql.service | ||
mysql --host 127.0.0.1 -uroot -proot -e 'CREATE DATABASE IF NOT EXISTS laravel;' | ||
mysql --host 127.0.0.1 -uroot -proot -e "SELECT @@global.secure_file_priv, @@global.local_infile" | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.2' | ||
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv | ||
coverage: none | ||
|
||
- name: Setup NodeJS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 14 | ||
|
||
- name: Install NodeJS dependencies | ||
run: | | ||
npm install | ||
- name: Install Composer dependencies | ||
run: composer install --no-interaction --prefer-dist --optimize-autoloader | ||
|
||
- name: Prepare Application | ||
run: | | ||
php artisan config:clear | ||
cp .env.example .env | ||
php artisan key:generate | ||
php artisan storage:link | ||
npm run build | ||
- name: Migrations | ||
run: php artisan migrate --force -v | ||
|
||
- name: PEST | ||
run: php artisan test --parallel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: PHPStan | ||
|
||
on: [push] | ||
|
||
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.2' | ||
coverage: none | ||
|
||
- name: Install composer dependencies | ||
uses: ramsey/composer-install@v3 | ||
|
||
- name: Run PHPStan | ||
run: ./vendor/bin/phpstan analyse --error-format=github --debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Fix Code Style | ||
|
||
on: [push] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
php: [8.2] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: json, dom, curl, libxml, mbstring | ||
coverage: none | ||
|
||
- name: Install Pint | ||
run: composer global require laravel/pint | ||
|
||
- name: Run Pint | ||
run: pint | ||
|
||
- name: Commit linted files | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: "Fixes coding style" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/.phpunit.cache | ||
/node_modules | ||
/public/build | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
/storage/debugbar/ | ||
/vendor | ||
.env | ||
.env.backup | ||
.env.production | ||
.phpactor.json | ||
.phpunit.result.cache | ||
Homestead.json | ||
Homestead.yaml | ||
auth.json | ||
npm-debug.log | ||
yarn-error.log | ||
/.fleet | ||
/.idea | ||
/.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# Larament | ||
|
||
[![Pint](https://github.com/codewithdennis/larament/actions/workflows/pint.yml/badge.svg)](https://packagist.org/packages/codewithdennis/larament) | ||
[![PEST](https://github.com/codewithdennis/larament/actions/workflows/pest.yml/badge.svg)](https://packagist.org/packages/codewithdennis/larament) | ||
[![Latest Version on Packagist](https://img.shields.io/packagist/v/codewithdennis/larament.svg?style=flat-square)](https://packagist.org/packages/codewithdennis/larament) | ||
|
||
![larament.png](https://raw.githubusercontent.com/CodeWithDennis/larament/main/resources/images/larament.png) | ||
|
||
|
||
Kickstart your project and save time with Larament! This time-saving starter kit includes a Laravel project with FilamentPHP already installed and set up, along with extra features. | ||
|
||
> [!NOTE] | ||
> This starter kit includes **Laravel 11** and **FilamentPHP 3** with some packages that improve the development experience. This will not contain any bloated features or unnecessary packages. If you want to add more features, you can do so by installing the necessary packages. | ||
|
||
## Filament Configuration and Extra's | ||
|
||
- The Filament Panel's primary color is set to blue. | ||
- Single Page Application (SPA) mode is enabled by default, providing faster and smoother user experiences. | ||
- A custom login page auto-fills email and password with seeded data, removing the need for manual typing in local testing. | ||
- Global search keybinding is preset to `CTRL + K` or `CMD + K` (for macOS) for quick access to search functionality. | ||
- A PEST test case for the `UserResource` ensures all functionalities are tested effectively. | ||
- The global user search includes email addresses in the search results for better user discovery. | ||
- A custom password generator action is available on the user profile and user resource pages. | ||
- A custom profile page utilizes the password generation feature for streamlined user management. | ||
- A ready-to-use custom theme includes a sidebar separator for better UI organization. | ||
- All component labels are automatically translatable, so there’s no need to add `->translateLabel()` to individual components. | ||
- Archtest is included for architectural testing. | ||
|
||
## [Helpers](https://laravel-news.com/creating-helpers) | ||
I've set up a Helper file for you to use in your Laravel app. You can find it at `app\Helpers.php`. This file is ready for you to add your custom helper functions, which Composer will automatically include in your project. | ||
|
||
## [Should Be Strict](https://laravel-news.com/shouldbestrict) | ||
This boilerplate has `shouldBeStrict` in the boot method of the `AppServiceProvider`. This setting will stop lazy loading (prevents N+1 query issues), silently discarding attributes, and prevent accessing missing attributes. This will help you catch errors early and improve the quality of your code. | ||
|
||
## Packages | ||
|
||
### [timokoerber/laravel-one-time-operations](https://github.com/TimoKoerber/laravel-one-time-operations) | ||
This package lets you run one-time tasks in your Laravel application. Instead of creating a new migration for a small job, you can use this package to run the task just once. Any new one-time operations will be placed in the `database/operations` folder. | ||
|
||
Also, adding this to your deployment can be really helpful because you won't need to manually run seeders if you want to modify data in your production environment. | ||
|
||
|
||
### [barryvdh/laravel-debugbar](https://github.com/barryvdh/laravel-debugbar) | ||
This package provides a developer toolbar for debugging Laravel applications. It includes a lot of helpful information like queries, routes, views, and more. | ||
|
||
### [pestphp/pest](https://pestphp.com/docs/installation) | ||
PESTPHP is a testing framework with a focus on simplicity, meticulously designed to bring back the joy of testing in PHP. | ||
|
||
> [!NOTE] | ||
> The new version 3 is now available and is the default testing framework in this boilerplate! | ||
#### Additional Plugins | ||
- [pestphp/pest-plugin-faker](https://pestphp.com/docs/plugins#faker) | ||
- [pestphp/pest-plugin-laravel](https://pestphp.com/docs/plugins#laravel) | ||
- [pestphp/pest-plugin-livewire](https://pestphp.com/docs/plugins#livewire) | ||
|
||
### [phpstan/phpstan](https://phpstan.org/user-guide/getting-started) | ||
PHPStan scans your whole codebase and looks for both obvious & tricky bugs. Even in those rarely executed if statements that certainly aren't covered by tests. | ||
|
||
## Installation | ||
|
||
**[Use this template](https://github.com/new?template_name=larament&template_owner=CodeWithDennis)** to create a new repository and clone it to your local machine, then navigate to the project directory to run the necessary commands. | ||
|
||
```bash | ||
composer install | ||
npm install && npm run build | ||
cp .env.example .env | ||
php artisan key:generate | ||
``` | ||
|
||
Since [Laravel 11](https://laravel.com/docs/11.x/releases#application-defaults) the default database is SQLite, if you want to use another database, update the `.env` file with your database preferences before running the migrations. | ||
|
||
```bash | ||
php artisan migrate --seed | ||
``` | ||
|
||
### Alternative Installation Method | ||
|
||
|
||
```bash | ||
composer create-project --prefer-dist CodeWithDennis/larament example-app | ||
``` | ||
|
||
If you don't want to remember the composer installation syntax for future projects, you can create an alias for your terminal: | ||
|
||
```bash | ||
alias larament="composer create-project --prefer-dist CodeWithDennis/larament" | ||
``` | ||
|
||
This allows you to simply use `larament project-example` in your terminal. | ||
|
||
```bash | ||
larament project-example | ||
cd project-example/ | ||
npm install && npm run build | ||
php artisan db:seed | ||
php artisan serve | ||
``` | ||
|
||
|
||
## Screenshots | ||
![user-global-search](https://raw.githubusercontent.com/CodeWithDennis/larament/main/resources/images/user-global-search.jpg) | ||
|
||
## Boilerplate | ||
The following files are part of the "branding" and can be removed. | ||
- resources/images/larament.png | ||
- resources/images/user-global-search.jpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace App\Filament\Actions; | ||
|
||
use Filament\Forms\Components\Actions\Action; | ||
use Filament\Forms\Set; | ||
use Filament\Notifications\Notification; | ||
use Illuminate\Support\Str; | ||
|
||
class GeneratePasswordAction extends Action | ||
{ | ||
public static function getDefaultName(): ?string | ||
{ | ||
return 'generatePassword'; | ||
} | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->icon('heroicon-s-key') | ||
->color('info') | ||
->action(function (Set $set) { | ||
$password = Str::password(); | ||
|
||
$set('password', $password); | ||
$set('passwordConfirmation', $password); | ||
|
||
Notification::make() | ||
->success() | ||
->title(__('Password successfully generated.')) | ||
->send(); | ||
}); | ||
} | ||
} |
Oops, something went wrong.