Skip to content

Commit e3009d8

Browse files
committed
feat: complete v1.0.0 implementation with tests
- Essential Laravel commands adapted for modular architecture - EasyModules-specific commands for domain entities and flexible generation - Comprehensive test suite with PHPUnit configuration - Auto-discovery and manual registration workflows
1 parent 7fba2e5 commit e3009d8

File tree

88 files changed

+23222
-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.

88 files changed

+23222
-0
lines changed

config/config.php

Lines changed: 362 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,362 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Base Path for Modules
8+
|--------------------------------------------------------------------------
9+
|
10+
| This is the root path where all your modules will be created. Each module's
11+
| classes, controllers, models, etc., will be generated within this path.
12+
|
13+
*/
14+
15+
'base_path' => app_path('Modules'),
16+
17+
/*
18+
|--------------------------------------------------------------------------
19+
| Base Namespace for Modules
20+
|--------------------------------------------------------------------------
21+
|
22+
| This namespace will be used as the root for all your modules. All generated
23+
| classes will use this namespace prefix.
24+
|
25+
*/
26+
27+
'base_namespace' => 'App\\Modules',
28+
29+
/*
30+
|--------------------------------------------------------------------------
31+
| Module Auto-Discovery
32+
|--------------------------------------------------------------------------
33+
|
34+
| When enabled, the package will automatically detect and register modules
35+
| based on their presence in the base path. Disable this if you prefer manual
36+
| registration of modules.
37+
|
38+
*/
39+
40+
'auto_discover' => true,
41+
42+
/*
43+
|--------------------------------------------------------------------------
44+
| Module Folders to Generate
45+
|--------------------------------------------------------------------------
46+
|
47+
| This array defines the list of folders that should be automatically
48+
| created when a new module is generated using the easymodules:new command.
49+
| These folders will be part of your module structure following Clean Architecture.
50+
|
51+
*/
52+
53+
'folders_to_generate' => [
54+
55+
// ⚙️ APPLICATION LAYER
56+
'Application/Actions', // Actions for Use Case Management
57+
'Application/DTOs', // Data Transfer Objects for communication between layers
58+
'Application/Mappers', // Mappers for converting between entities and DTOs
59+
'Application/Interfaces', // Interfaces for communication with external services
60+
'Application/Services', // Services for use cases
61+
'Application/Validation', // Validation of incoming data
62+
'Application/Rules', // Reusable business rules
63+
64+
// 🧠 DOMAIN LAYER
65+
'Domain/Entities', // Domain entities (business models)
66+
'Domain/Services', // Business services in the domain
67+
'Domain/ValueObjects', // Value objects used in entities
68+
69+
// 🏛️ INFRASTRUCTURE LAYER
70+
'Infrastructure/Mappers', // Mappers for transformation between entities and models
71+
'Infrastructure/Models', // Persistence-related models (database)
72+
'Infrastructure/Casts', // Custom casts for models
73+
'Infrastructure/Persistence', // Data persistence implementations, repositories
74+
'Infrastructure/Services', // External technical or integration services
75+
'Infrastructure/Exceptions', // Custom exceptions for error handling
76+
77+
// 🎨 PRESENTATION LAYER
78+
'Presentation/Mappers', // Mappers for display-related transformations
79+
'Presentation/Console/Commands',// Custom commands via Artisan
80+
'Presentation/Http/Controllers',// HTTP controllers for request handling
81+
'Presentation/Http/Requests', // HTTP requests to validate and transform data
82+
'Presentation/Http/Middlewares',// Middleware to filter incoming requests
83+
'Presentation/Http/Resources', // Resources for formatting responses
84+
'Presentation/Views/Components',// View components for the UI
85+
'Presentation/resources/views', // Folder containing views (e.g., Blade)
86+
87+
// 🗄️ DATABASE LAYER
88+
'Database/Factories', // Model factories for testing
89+
'Database/Seeders', // Database seeders
90+
'Database/Migrations', // Migrations for database schema management
91+
92+
// 🌍 LOCALIZATION
93+
'lang', // Translation files
94+
95+
// 🧪 TESTING
96+
'Tests/Unit', // Unit testing
97+
'Tests/Feature', // Feature/Integration tests
98+
],
99+
100+
/*
101+
|--------------------------------------------------------------------------
102+
| Module Scaffold Folders
103+
|--------------------------------------------------------------------------
104+
|
105+
| This array defines the essential folders that will be created in addition
106+
| to the folders_to_generate when running the module creation command.
107+
| These are the base folders needed for scaffold components.
108+
|
109+
*/
110+
111+
'scaffold' => [
112+
'Providers', // Folder for service providers
113+
'config', // Folder for configuration files
114+
'routes', // Folder for route definitions
115+
],
116+
117+
/*
118+
|--------------------------------------------------------------------------
119+
| Component Path Mapping
120+
|--------------------------------------------------------------------------
121+
|
122+
| Each key represents a file type supported by Laravel's generators.
123+
| The corresponding value is the relative path (inside the module) where
124+
| the file should be placed when generated. Used by make commands.
125+
|
126+
*/
127+
128+
'paths' => [
129+
// 🏗️ SCAFFOLD COMPONENTS
130+
'provider' => 'Providers',
131+
'config' => 'config',
132+
'routes' => 'routes',
133+
134+
// 🧠 DOMAIN LAYER
135+
'entity' => 'Domain/Entities',
136+
'valueobject' => 'Domain/ValueObjects',
137+
138+
// 🏛️ INFRASTRUCTURE LAYER
139+
'repository' => 'Infrastructure/Persistence/Repositories',
140+
'model' => 'Infrastructure/Models',
141+
'scope' => 'Infrastructure/Models/Scopes',
142+
'cast' => 'Infrastructure/Casts',
143+
'job' => 'Infrastructure/Jobs',
144+
'job-middleware' => 'Infrastructure/Jobs/Middlewares',
145+
'event' => 'Infrastructure/Events',
146+
'listener' => 'Infrastructure/Listeners',
147+
'mail' => 'Infrastructure/Mails',
148+
'notification' => 'Infrastructure/Notifications',
149+
'policy' => 'Infrastructure/Policies',
150+
'rule' => 'Infrastructure/Rules',
151+
'observer' => 'Infrastructure/Observers',
152+
'channel' => 'Infrastructure/Broadcasting',
153+
'exception' => 'Infrastructure/Exceptions',
154+
155+
// 🎨 PRESENTATION LAYER
156+
'command' => 'Presentation/Console/Commands',
157+
'controller' => 'Presentation/Http/Controllers',
158+
'request' => 'Presentation/Http/Requests',
159+
'middleware' => 'Presentation/Http/Middlewares',
160+
'resource' => 'Presentation/Http/Resources',
161+
'component' => 'Presentation/Views/Components',
162+
'view' => 'Presentation/resources/views',
163+
164+
// 🗄️ DATABASE LAYER
165+
'migration' => 'Database/Migrations',
166+
'seeder' => 'Database/Seeders',
167+
'factory' => 'Database/Factories',
168+
169+
// 🌍 LOCALIZATION
170+
'lang' => 'lang',
171+
172+
// 🧪 TESTING
173+
'unittest' => 'Tests/Unit',
174+
'featuretest' => 'Tests/Feature',
175+
],
176+
177+
/*
178+
|--------------------------------------------------------------------------
179+
| Test Path Mapping
180+
|--------------------------------------------------------------------------
181+
|
182+
| Each key represents a component type that can generate tests with --test option.
183+
| The corresponding value is the relative path (inside Tests/Feature or Tests/Unit)
184+
| where the test should be placed. Used by make commands with --test flag.
185+
| If a component type is not found, the key is used as-is for custom paths.
186+
|
187+
*/
188+
189+
'test_paths' => [
190+
191+
// 🧠 DOMAIN LAYER
192+
'entity' => 'Domain/Entities',
193+
'valueobject' => 'Domain/ValueObjects',
194+
195+
// 🏛️ INFRASTRUCTURE LAYER
196+
'repository' => 'Infrastructure/Persistence/Repositories',
197+
'model' => 'Infrastructure/Models',
198+
'scope' => 'Infrastructure/Models/Scopes',
199+
'cast' => 'Infrastructure/Casts',
200+
'job' => 'Infrastructure/Jobs',
201+
'event' => 'Infrastructure/Events',
202+
'listener' => 'Infrastructure/Listeners',
203+
'mail' => 'Infrastructure/Mails',
204+
'notification' => 'Infrastructure/Notifications',
205+
'policy' => 'Infrastructure/Policies',
206+
'rule' => 'Infrastructure/Rules',
207+
'observer' => 'Infrastructure/Observers',
208+
'channel' => 'Infrastructure/Broadcasting',
209+
'exception' => 'Infrastructure/Exceptions',
210+
211+
// 🎨 PRESENTATION LAYER
212+
'command' => 'Presentation/Console/Commands',
213+
'controller' => 'Presentation/Http/Controllers',
214+
'request' => 'Presentation/Http/Requests',
215+
'middleware' => 'Presentation/Http/Middlewares',
216+
'resource' => 'Presentation/Http/Resources',
217+
'component' => 'Presentation/Views/Components',
218+
'view' => 'Presentation/resources/views',
219+
220+
// Shortcuts
221+
'c' => 'Presentation/Http/Controllers',
222+
's' => 'Application/Services',
223+
'e' => 'Domain/Entities',
224+
],
225+
226+
/*
227+
|--------------------------------------------------------------------------
228+
| Append Suffixes to Class Names
229+
|--------------------------------------------------------------------------
230+
|
231+
| When enabled, the generator will append appropriate suffixes (e.g., 'Controller',
232+
| 'Model') to class names based on their type. This helps maintain consistency
233+
| in naming conventions across your application.
234+
|
235+
*/
236+
237+
'append_suffix' => false,
238+
239+
/*
240+
|--------------------------------------------------------------------------
241+
| Class Name Suffixes
242+
|--------------------------------------------------------------------------
243+
|
244+
| This array defines the suffixes to be appended to class names for each
245+
| type of class. For example, a 'model' type will have 'Model' appended,
246+
| resulting in 'UserModel' if the base name is 'User'.
247+
|
248+
*/
249+
250+
'suffixes' => [
251+
'model' => 'Model',
252+
'controller' => 'Controller',
253+
'request' => 'Request',
254+
'resource' => 'Resource',
255+
'cast' => 'Cast',
256+
'factory' => 'Factory',
257+
'seeder' => 'Seeder',
258+
'migration' => 'Migration',
259+
'middleware' => 'Middleware',
260+
'command' => 'Command',
261+
'job' => 'Job',
262+
'event' => 'Event',
263+
'listener' => 'Listener',
264+
'mail' => 'Mail',
265+
'notification' => 'Notification',
266+
'policy' => 'Policy',
267+
'provider' => 'Provider',
268+
'rule' => 'Rule',
269+
'observer' => 'Observer',
270+
'channel' => 'Channel',
271+
'exception' => 'Exception',
272+
'entity' => 'Entity',
273+
'interface' => 'Interface',
274+
'scope' => 'Scope',
275+
'component' => 'Component',
276+
],
277+
278+
/*
279+
|--------------------------------------------------------------------------
280+
| Scaffold Template Files
281+
|--------------------------------------------------------------------------
282+
|
283+
| This array defines the paths to stub files that will be used to generate
284+
| the base files within the scaffold folders. These templates create the
285+
| essential files needed to initialize a functional module (ServiceProvider,
286+
| config, routes).
287+
|
288+
*/
289+
290+
'stubs_scaffold' => [
291+
'config' => 'easymodules/scaffold/config.stub',
292+
'service_provider' => 'easymodules/scaffold/service_provider.stub',
293+
'route_web' => 'easymodules/scaffold/route_web.stub',
294+
'route_api' => 'easymodules/scaffold/route_api.stub',
295+
'route_console' => 'easymodules/scaffold/route_console.stub',
296+
],
297+
298+
/*
299+
|--------------------------------------------------------------------------
300+
| Component Template Files
301+
|--------------------------------------------------------------------------
302+
|
303+
| This array defines the path to stub files for each type of class.
304+
| These paths should be relative to the resources/stubs directory
305+
| or absolute if needed. Used by individual make commands.
306+
|
307+
*/
308+
309+
'stubs' => [
310+
311+
// 🏗️ SCAFFOLD COMPONENTS
312+
'provider' => 'easymodules/provider.stub',
313+
'config' => 'easymodules/config.stub',
314+
315+
// 🧠 DOMAIN LAYER
316+
'entity' => 'easymodules/entity.stub',
317+
'valueobject' => 'easymodules/valueobject.stub',
318+
'domainservice' => 'easymodules/domain-service.stub',
319+
320+
// ⚙️ APPLICATION LAYER
321+
'action' => 'easymodules/action.stub',
322+
'dto' => 'easymodules/dto.stub',
323+
'mapper' => 'easymodules/mapper.stub',
324+
'interface' => 'easymodules/interface.stub',
325+
'service' => 'easymodules/service.stub',
326+
'validation' => 'easymodules/validation.stub',
327+
328+
// 🏛️ INFRASTRUCTURE LAYER
329+
'repository' => 'easymodules/repository.stub',
330+
'persistence' => 'easymodules/persistence.stub',
331+
'model' => 'easymodules/model.stub',
332+
'cast' => 'easymodules/cast.stub',
333+
'factory' => 'easymodules/factory.stub',
334+
'seeder' => 'easymodules/seeder.stub',
335+
'migration' => 'easymodules/migration.stub',
336+
'middleware' => 'easymodules/middleware.stub',
337+
'command' => 'easymodules/command.stub',
338+
'job' => 'easymodules/job.stub',
339+
'job-middleware' => 'easymodules/job.middleware.stub',
340+
'event' => 'easymodules/event.stub',
341+
'listener' => 'easymodules/listener.stub',
342+
'mail' => 'easymodules/mail.stub',
343+
'notification' => 'easymodules/notification.stub',
344+
'policy' => 'easymodules/policy.stub',
345+
'rule' => 'easymodules/rule.stub',
346+
'observer' => 'easymodules/observer.stub',
347+
'channel' => 'easymodules/channel.stub',
348+
'exception' => 'easymodules/exception.stub',
349+
350+
// 🎨 PRESENTATION LAYER
351+
'controller' => 'easymodules/controller.stub',
352+
'request' => 'easymodules/request.stub',
353+
'resource' => 'easymodules/resource.stub',
354+
'component' => 'easymodules/component.stub',
355+
356+
// 🧪 TESTING LAYER
357+
'test' => 'easymodules/test.stub',
358+
'featuretest' => 'easymodules/feature-test.stub',
359+
360+
],
361+
362+
];

0 commit comments

Comments
 (0)