1- # SETUP############################################
1+ # Project setup commands
2+ # -------------------------------------------------
23
4+ # Run PHP's built-in server for the public directory
35run :
46 cd public; sudo php -S 0.0.0.0:8030
57
8+ # Build and start Docker containers (Linux)
69docker_run_linux :
710 sudo docker-compose build
811 sudo docker-compose up
912
13+ # Stop Docker containers (Linux)
1014docker_stop_linux :
1115 sudo docker-compose down
1216
17+ # Build and start Docker containers (Windows)
1318docker_run_win :
1419 docker-compose build
1520 docker-compose up
1621
22+ # Stop Docker containers (Windows)
1723docker_stop_win :
1824 docker-compose down
1925
20- # MIGRATIONS########################################
26+ # Database migrations
27+ # -------------------------------------------------
2128
29+ # Run all new migrations to update the database schema
2230migrate :
2331 php spark migrate
2432
33+ # Show the current status of migrations
2534migrations_status :
2635 php spark migrate:status
2736
37+ # Rollback all database migrations, effectively deleting all tables
2838delete_all_tables :
2939 php spark migrate:rollback
3040
41+ # Placeholder for creating a new migration file
3142create_migration :
3243 echo php spark make:migration NameOfMigration
3344
45+ # Shortcut to update the database to the latest migration
3446update_db :
3547 php spark migrate:latest
3648
37- # SEEDS#############################################
49+ # Database seeding
50+ # -------------------------------------------------
3851
52+ # Placeholder for creating a new seeder file
3953create_seed :
4054 echo php spark make:seeder NameOfSeeder
4155
56+ # Run all database seeders
4257all_seeds :
4358 php spark db:seed
4459
45- some_seed :
46- echo php spark db:seed ProductionProductsSeeder
47- echo php spark db:seed ProductionDetailsSeeder
48- echo php spark db:seed ProductionPropertySeeder
49- echo php spark db:seed ProductionSubpropertySeeder
50-
51- # DOCKER############################################
60+ # Docker management
61+ # -------------------------------------------------
5262
63+ # Build Docker images based on the docker-compose.yml
5364build :
5465 docker-compose build
5566
67+ # Start Docker containers in detached mode
5668up :
5769 docker-compose up -d
5870
71+ # Stop and remove Docker containers
5972down :
6073 docker-compose down
6174
75+ # Restart Docker containers
6276restart :
6377 make down
6478 make up
6579
80+ # Linux-specific Docker management commands
6681build_linux :
6782 sudo docker-compose build
6883
@@ -76,39 +91,136 @@ restart_linux:
7691 make down_linux
7792 make up_linux
7893
79- # REDIS#############################################
94+ # Redis commands
95+ # -------------------------------------------------
8096
97+ # Clear all data from Redis cache
8198clear_cache :
8299 redis-cli FLUSHALL
83100
84- # FORMAT############################################
85-
86- # sudo apt-get update
87- # sudo apt-get install php-xml
88- # sudo apt install php-codesniffer
101+ # Redis commands within Docker
102+ # -------------------------------------------------
103+
104+ # Clear the Redis cache within Docker
105+ # This command connects to the Redis container and executes the `FLUSHALL` command via redis-cli,
106+ # which deletes all keys from all databases in Redis, effectively clearing the cache.
107+ # Use with caution, as this cannot be undone and will remove all data stored in Redis.
108+ clear_cache_docker :
109+ docker-compose exec redis redis-cli FLUSHALL
110+
111+ # View logs for the Redis service
112+ # This command retrieves and displays the logs for the Redis container,
113+ # which is useful for debugging and monitoring Redis activity.
114+ redis_logs :
115+ docker-compose logs redis
116+
117+ # Stop the Redis service in Docker
118+ # This stops the Redis container without removing it, allowing you to start it again later
119+ # without having to rebuild or recreate the container.
120+ redis_docker_stop :
121+ docker-compose stop redis
122+
123+ # Start the Redis service in Docker
124+ # If the Redis container was previously stopped using `docker-compose stop redis`,
125+ # this command restarts it without needing to recreate the container.
126+ redis_docker_start :
127+ docker-compose start redis
128+
129+ # Code formatting and linting
130+ # -------------------------------------------------
131+
132+ # Automatically fix PHP code style issues
89133format :
90134 ./vendor/bin/phpcbf --standard=./configs/phpcs.xml app/ || true
91135
136+ # Run format using Composer script
92137format_from_composer :
93138 composer run format
94139
140+ # Lint PHP files for syntax errors
95141lint :
96142 ./vendor/bin/phplint --configuration ./configs/.phplint.yml
97143
144+ # Run lint using Composer script
98145lint_from_composer :
99146 composer run lint
100147
148+ # Check PHP code style for issues
101149check_format :
102150 ./vendor/bin/phpcs --standard=./configs/phpcs.xml app/ > warnings
103151
152+ # Run check_format using Composer script
104153check_format_from_composer :
105154 composer run check_format
106155
156+ # Psalm static analysis
157+ # -------------------------------------------------
158+
159+ # Run Psalm for static analysis
107160psalm :
108161 vendor/bin/psalm --config=./configs/psalm.xml
109162
163+ # Clear Psalm's cache
110164psalm_clear_cache :
111165 vendor/bin/psalm --clear-cache --config=./configs/psalm.xml
112166
167+ # Force Psalm to run even if up-to-date
113168psalm_forced_start :
114- make -B psalm
169+ make -B psalm
170+
171+ # Adminer Commands
172+ # -------------------------------------------------
173+
174+ # Start the Adminer service in Docker
175+ adminer_docker_start :
176+ docker-compose start adminer
177+
178+ # Stop the Adminer service in Docker
179+ adminer_docker_stop :
180+ docker-compose stop adminer
181+
182+ # Restart the Adminer service in Docker
183+ adminer_docker_restart :
184+ docker-compose restart adminer
185+
186+ # Connect to the Adminer container
187+ adminer_shell :
188+ docker-compose exec adminer sh
189+
190+ # MySQL Commands
191+ # -------------------------------------------------
192+
193+ # Start the MySQL service in Docker
194+ mysql_docker_start :
195+ docker-compose start mysql
196+
197+ # Stop the MySQL service in Docker
198+ mysql_docker_stop :
199+ docker-compose stop mysql
200+
201+ # Restart the MySQL service in Docker
202+ mysql_docker_restart :
203+ docker-compose restart mysql
204+
205+ # Connect to the MySQL container
206+ mysql_shell :
207+ docker-compose exec mysql bash
208+
209+ # Nginx Commands
210+ # -------------------------------------------------
211+
212+ # Start the Nginx service in Docker
213+ nginx_docker_start :
214+ docker-compose start nginx
215+
216+ # Stop the Nginx service in Docker
217+ nginx_docker_stop :
218+ docker-compose stop nginx
219+
220+ # Restart the Nginx service in Docker
221+ nginx_docker_restart :
222+ docker-compose restart nginx
223+
224+ # Connect to the Nginx container
225+ nginx_shell :
226+ docker-compose exec nginx sh
0 commit comments