Skip to content

Commit cbcdae6

Browse files
committed
Initial commit
0 parents  commit cbcdae6

File tree

67 files changed

+2679
-0
lines changed

Some content is hidden

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

67 files changed

+2679
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
description: Coding pattern preferences
3+
globs:
4+
alwaysApply: true
5+
---
6+
# Coding pattern preferences
7+
8+
- Provide simple solutions.
9+
- If multiple solutions are available, consider the CRAP score
10+
- Avoid duplication of code whenever possible: check for areas of the codebase that might already have similar code functionality
11+
- Write code that takes into account the different environments: local, test, and production
12+
- You are careful to only make changes that are requested or you are confident are well understood and related to the change being requested
13+
- When fixing an issue or bug, do not introduce a new pattern or technology without first exhausting all options for the existing implementation. And if you finally do this, make sure to remove the old implementation afterwards so we don’t have duplicate logic
14+
- Keep the codebase very clean and organized. Follow Laravel principles and file structure
15+
- Avoid storing scripts in files if possible, especially if the script is likely only to be run once
16+
- Avoid huge files over 200-300 lines of code. Refactor at that point
17+
- Mock data if data is only needed for tests, never mock data for production environment
18+
- Use factories for mock Eloquent Model data
19+
- **Never** add stubbing or fake data patterns to code that affects local or production environments
20+
- **Never** commit your .env file without first asking and confirming
21+
- Order class imports in alpha order
22+
- Order class use traits in alpha order

.cursor/rules/stack.mdc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
description: Technical stack
3+
globs:
4+
alwaysApply: true
5+
---
6+
# Technical stack
7+
8+
- PHP8.4 and above
9+
- Laravel 12 for the backend.
10+
- Laravel Blade should be used for static components
11+
- Laravel Livewire should be used for interactive components
12+
- Laravel Actions should be used for database operations. You can read more about it here: https://www.laravelactions.com
13+
- FluxUI for UI components. Refresh your memory once per day at: https://fluxui.dev/docs/
14+
- HTML/JS for the frontend
15+
- AlpineJS is the preferred JS framework. Refresh your memory once a week at: https://alpinejs.dev/start-here
16+
- MySQL database for the storage. MySQL is running MySQL 8.0
17+
- Use PHPUnit for writing tests

.cursor/rules/workflow.mdc

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
description: Workflow preferences
3+
globs:
4+
alwaysApply: true
5+
---
6+
# Key Conventions
7+
1. **Follow Laravel's MVC architecture.**
8+
2. **Use Laravel's routing system for defining application endpoints.**
9+
3. **Implement proper request validation using Form Requests.**
10+
4. **Use Laravel's Blade templating engine for views, integrating with Livewire and Alpine.js.**
11+
5. **Implement proper database relationships using Eloquent.**
12+
6. **Use Laravel's built-in authentication scaffolding.**
13+
7. **Implement proper API resource transformations.**
14+
8. **Use Laravel's event and listener system for decoupled code.**
15+
16+
## Coding workflow
17+
18+
- **Focus on the areas of code relevant to the task**
19+
- **Do not touch code that is unrelated to the task**
20+
- **Write thorough tests for all major functionality**.
21+
- **Write concise, technical responses with accurate PHP examples.**
22+
- **Follow Laravel best practices and conventions.**
23+
- **Use object-oriented programming with a focus on SOLID principles.**
24+
- **Prefer iteration and modularization over duplication.**
25+
- **Use descriptive variable and method names.**
26+
- **Favor dependency injection and service containers.**
27+
- **Avoid making major changes to the patterns and architecture of how a feature works, after it has shown to work well, unless explicitly structured**
28+
- **Always think about what other methods and areas of code might be affected by code changes**
29+
- **When using Actions for database operations, stick with model as the part of the namespace. Use appropriate nomenclature: Store{Model} for creating new records, Update{Model} for updating records, Destroy{Model} for deleting records. For example: `App\Actions\User\StoreUser`, `App\Actions\User\UpdateUser`, `App\Actions\User\DestroyUser`.**
30+
- **When composing Blade components, if it requires a typed property, like an Eloquent model, always create a Component class.**
31+
- **When composing Blade components, if the resulting view is shorter then 10 lines, consider using inline component**
32+
- **Focus on the areas of code relevant to the task**
33+
- **Do not touch code that is unrelated to the task**
34+
35+
36+
## PHP and Laravel Core
37+
- **Use PHP 8.3+ features when appropriate (e.g., typed properties, match expressions).**
38+
- **Follow PSR-12 coding standards.**
39+
- **Utilize Laravel's built-in features and helpers when possible.**
40+
- **Follow Laravel's directory structure and naming conventions.**
41+
- **Use lowercase with dashes for directories (e.g., `app/Http/Controllers`).**
42+
- **Implement proper error handling and logging:**
43+
- **Use Laravel's exception handling and logging features.**
44+
- **Create custom exceptions when necessary.**
45+
- **Use try-catch blocks for expected exceptions.**
46+
- **Use Laravel's validation features for form and request validation.**
47+
- **Implement middleware for request filtering and modification.**
48+
- **Utilize Laravel's Eloquent ORM for database interactions.**
49+
- **Use Laravel's query builder for complex database queries.**
50+
- **Implement proper database migrations and seeders.**
51+
52+
## Laravel Best Practices
53+
- **Use Eloquent ORM instead of raw SQL queries when possible.**
54+
- **Implement Repository pattern for data access layer.**
55+
- **Use Laravel's built-in authentication and authorization features.**
56+
- **Utilize Laravel's caching mechanisms for improved performance.**
57+
- **Implement job queues for long-running tasks.**
58+
- **Use Laravel's built-in testing tools (PHPUnit, Pest, Dusk) for unit and feature tests.**
59+
- **Implement API versioning for public APIs.**
60+
- **Use Laravel's localization features for multi-language support.**
61+
- **Implement proper CSRF protection and security measures.**
62+
- **Use Laravel Mix for asset compilation.**
63+
- **Implement proper database indexing for improved query performance.**
64+
- **Use Laravel's built-in pagination features.**
65+
- **Implement proper error logging and monitoring.**
66+
- When writing code, strive to type-hint every parameter and type-hint return.
67+
- When writing code, avoid unnecessary docBlocks when parameters are type-hinted
68+
- When writing code, when necessary, provide simple and easy to understand method description
69+
- When wriring Eloquent queries, consider using tappable scopes to avod leaking internals. For example, instead of writing `->whereNull('user_id')`, consider `->tap(new Orphan())` and write a tappable scope like this:
70+
```php
71+
use Illuminate\Contracts\Database\Query\Builder;
72+
73+
final readonly class Orphan
74+
{
75+
public function __invoke(Builder $builder): void
76+
{
77+
$builder->whereNull('user_id');
78+
}
79+
}
80+
```
81+
82+
## Livewire Implementation
83+
- **Create modular, reusable Livewire components.**
84+
- **Use Livewire's lifecycle hooks effectively (e.g., `mount`, `updated`, etc.).**
85+
- **Implement real-time validation using Livewire's built-in validation features.**
86+
- **Optimize Livewire components for performance, avoiding unnecessary re-renders.**
87+
- **Integrate Livewire components with Laravel's backend features seamlessly.**
88+
89+
## Alpine.js Usage
90+
- **Use Alpine.js directives (`x-data`, `x-bind`, `x-on`, etc.) for declarative JavaScript functionality.**
91+
- **Implement small, focused Alpine.js components for specific UI interactions.**
92+
- **Combine Alpine.js with Livewire for enhanced interactivity when necessary.**
93+
- **Keep Alpine.js logic close to the HTML it manipulates, preferably inline.**
94+
95+
## Tailwind CSS Styling
96+
- **Utilize Tailwind's utility classes for responsive design.**
97+
- **Implement a consistent color scheme and typography using Tailwind's configuration.**
98+
- **Use Tailwind's `@apply` directive in CSS files for reusable component styles.**
99+
- **Optimize for production by purging unused CSS classes.**
100+
101+
## Performance Optimization
102+
- **Implement lazy loading for Livewire components when appropriate.**
103+
- **Use Laravel's caching mechanisms for frequently accessed data.**
104+
- **Minimize database queries by eager loading relationships.**
105+
- **Implement pagination for large data sets.**
106+
- **Use Laravel's built-in scheduling features for recurring tasks.**
107+
108+
## Security Best Practices
109+
- **Always validate and sanitize user input.**
110+
- **Use Laravel's CSRF protection for all forms.**
111+
- **Implement proper authentication and authorization using Laravel's built-in features.**
112+
- **Use Laravel's prepared statements to prevent SQL injection.**
113+
- **Implement proper database transactions for data integrity.**
114+
115+
## Testing
116+
- **Write functional tests for every class.**
117+
- **Implement feature tests for Livewire components using Laravel's testing tools.**
118+
- **Ensure 100% coverage.**
119+
- **Write Pest tests only.**
120+
- When writing tests make sure to match the namespace, for example for `App\Components\ProgramLocationLookup\ProgramLocationLookupManager` the test should be
121+
`Tests\Feature\Components\ProgramLocationLookup\ProgramLocationLookupManagerTest`
122+
- When writing tests, use snake_case for test names, begining with 'it_will', for example, `it_will_create_venue_program_location_lookup_driver`
123+
- When writing tests, make sure to add `void` return type
124+
- When writing tests, you may use Model::factory() to create model stubs
125+
- When writing tests, you may mock action classes, for eaxmple: `ActionClass::mock()->expects('handle')->with($argument)`
126+
- When test generation is complete, run it using `php vendor/bin/pest` to ensure it is not failing
127+
- once the test is successful, make sure to run complete test suit to ensure it is not failing
128+
129+
- When complete, run `php vendor/bin/pint`

.devcontainer/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Base image is from Microsoft
2+
FROM mcr.microsoft.com/vscode/devcontainers/base:ubuntu-22.04
3+
4+
# Avoid interactive prompts (e.g. tzdata) during installation
5+
ENV DEBIAN_FRONTEND=noninteractive
6+
7+
RUN mkdir -p /var/www/html
8+
9+
# Install 8.3 from Ondrej’s PPA
10+
RUN apt-get update && apt-get install -y \
11+
software-properties-common \
12+
&& add-apt-repository ppa:ondrej/php -y \
13+
&& apt-get update && apt-get install -y sqlite3 \
14+
&& apt-get install -y php8.3-cli php8.3-dev \
15+
php8.3-pgsql php8.3-sqlite3 php8.3-gd \
16+
php8.3-curl \
17+
php8.3-imap php8.3-mysql php8.3-mbstring \
18+
php8.3-xml php8.3-zip php8.3-bcmath php8.3-soap \
19+
php8.3-intl php8.3-readline \
20+
php8.3-ldap \
21+
php8.3-msgpack php8.3-igbinary php8.3-redis php8.3-swoole \
22+
php8.3-memcached php8.3-pcov php8.3-imagick php8.3-xdebug \
23+
&& apt-get clean && rm -rf /var/lib/apt/lists/*

.devcontainer/devcontainer.bash

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
alias art='php artisan --ansi'
2+
alias tinker='art tinker'
3+
alias format='php vendor/bin/pint'
4+
alias analyze='php vendor/bin/phpstan analyse'
5+
alias test='php vendor/bin/paratest --coverage-html coverage'
6+
alias stf='php vendor/bin/phpunit --filter'
7+
8+
# commit AI
9+
function commit() {
10+
commitMessage="$*"
11+
12+
git add .
13+
14+
if [ "$commitMessage" = "" ]; then
15+
aicommits
16+
return
17+
fi
18+
19+
eval "git commit -a -m '${commitMessage}'"
20+
}
21+
22+
# function gfind
23+
function gfind() {
24+
local excludeVendor="--exclude-dir=vendor" # Default to excluding the vendor directory
25+
local searchString=""
26+
local searchPath="./"
27+
28+
# Process all arguments
29+
for arg in "$@"; do
30+
if [[ "$arg" == "-w" || "$arg" == "--with-vendor" ]]; then
31+
excludeVendor="" # Remove the exclude directive to include vendor
32+
elif [[ -z "$searchString" && "$arg" != -* ]]; then
33+
searchString="$arg" # Set the search string if it's not a flag and is the first non-flag argument
34+
fi
35+
done
36+
37+
# Check if a search string was provided
38+
if [[ -z "$searchString" ]]; then
39+
echo -e "${RED}Error: Missing required search string.${NC}"
40+
echo -e "${YELLOW}Usage: ${NC}gfind searchString [-w|--with-vendor]"
41+
return 1
42+
fi
43+
44+
# Execute grep command
45+
grep --include=\*.php $excludeVendor -rnw $searchPath -e "$searchString"
46+
}

.devcontainer/devcontainer.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "Laravel Exportify",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"context": "."
6+
},
7+
"features": {},
8+
"customizations": {
9+
"vscode": {
10+
"extensions": [
11+
"bmewburn.vscode-intelephense-client",
12+
"calebporzio.better-phpunit",
13+
"laravel.vscode-laravel",
14+
"mikestead.dotenv",
15+
"ms-azuretools.vscode-docker",
16+
"php.intelephense"
17+
],
18+
"settings": {
19+
"intelephense.environment.phpVersion": "8.3"
20+
}
21+
}
22+
},
23+
"remoteUser": "vscode",
24+
"postCreateCommand": "cat ./devcontainer.bash >> /home/vscode/.bashrc",
25+
"forwardPorts": [],
26+
"portsAttributes": {}
27+
}

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2

.gitattributes

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.github export-ignore
6+
/.gitattributes export-ignore
7+
/.gitignore export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/art export-ignore
10+
/docs export-ignore
11+
/tests export-ignore
12+
/workbench export-ignore
13+
/.editorconfig export-ignore
14+
/.php_cs.dist.php export-ignore
15+
/psalm.xml export-ignore
16+
/psalm.xml.dist export-ignore
17+
/testbench.yaml export-ignore
18+
/UPGRADING.md export-ignore
19+
/phpstan.neon.dist export-ignore
20+
/phpstan-baseline.neon export-ignore

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: Binary Cats

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Bug Report
2+
description: Report an Issue or Bug with the Package
3+
title: "[Bug]: "
4+
labels: ["bug"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
We're sorry to hear you have a problem. Can you help us solve it by providing the following details.
10+
- type: textarea
11+
id: what-happened
12+
attributes:
13+
label: What happened?
14+
description: What did you expect to happen?
15+
placeholder: I cannot currently do X thing because when I do, it breaks X thing.
16+
validations:
17+
required: true
18+
- type: textarea
19+
id: how-to-reproduce
20+
attributes:
21+
label: How to reproduce the bug
22+
description: How did this occur, please add any config values used and provide a set of reliable steps if possible.
23+
placeholder: When I do X I see Y.
24+
validations:
25+
required: true
26+
- type: input
27+
id: package-version
28+
attributes:
29+
label: Package Version
30+
description: What version of our Package are you running? Please be as specific as possible
31+
placeholder: 2.0.0
32+
validations:
33+
required: true
34+
- type: input
35+
id: php-version
36+
attributes:
37+
label: PHP Version
38+
description: What version of PHP are you running? Please be as specific as possible
39+
placeholder: 8.2.0
40+
validations:
41+
required: true
42+
- type: input
43+
id: laravel-version
44+
attributes:
45+
label: Laravel Version
46+
description: What version of Laravel are you running? Please be as specific as possible
47+
placeholder: 9.0.0
48+
validations:
49+
required: true
50+
- type: dropdown
51+
id: operating-systems
52+
attributes:
53+
label: Which operating systems does this happen with?
54+
description: You may select more than one.
55+
multiple: true
56+
options:
57+
- macOS
58+
- Windows
59+
- Linux
60+
- type: textarea
61+
id: notes
62+
attributes:
63+
label: Notes
64+
description: Use this field to provide any other notes that you feel might be relevant to the issue.
65+
validations:
66+
required: false

0 commit comments

Comments
 (0)