Skip to content

Commit f446847

Browse files
committed
Add missing documentation commands and shell access to Makefile and README
This comprehensive update enhances the Makefile and README with missing functionality and documentation: 1. Add new API documentation workflow commands: - 'apidocs-serve' to start a web server for viewing documentation - 'apidocs' to both generate and serve documentation in one step 2. Add container shell access command: - 'php-connect' to provide an interactive shell within the PHP container - Properly handle running container checks and user feedback 3. Update the help command in Makefile with: - New documentation section listing all API documentation commands - Container access section for the shell access commands - Description for 'composer-script' showing usage with arguments 4. Update README command table: - Replace deprecated 'apidoc' with 'apidocs-generate' - Add the new 'apidocs-serve' and 'apidocs' commands - Add 'php-connect' command with description - Ensure all command descriptions are clear and consistent These additions provide developers with more flexible options for generating and accessing API documentation, as well as improved direct access to the containerized environment for debugging and maintenance tasks.
1 parent 5b9cfec commit f446847

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

Makefile

+17-13
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,12 @@ help:
6767
@echo "${GREEN}Database commands:${NC}"
6868
@echo " ${YELLOW}db-dump${NC} Create backup of all databases"
6969
@echo " ${YELLOW}db-restore${NC} Restore backup of all databases"
70-
@echo " ${YELLOW}db-connect${NC} Connect to MySQL shell"
7170
@echo ""
7271
@echo "${GREEN}Utility commands:${NC}"
73-
@echo " ${YELLOW}php-connect${NC} Connect to PHP container shell"
7472
@echo " ${YELLOW}gen-certs${NC} Generate SSL certificates"
7573
@echo " ${YELLOW}enable-ssl${NC} Enable SSL in Nginx configuration"
7674
@echo " ${YELLOW}env-clean${NC} Clean environment resources"
7775
@echo " ${YELLOW}env-reset${NC} Reset environment (including volumes)"
78-
@echo " ${YELLOW}apidoc${NC} Generate API documentation"
7976
@echo ""
8077
@echo "${GREEN}Framework commands:${NC}"
8178
@echo " ${YELLOW}install-symfony${NC} Install Symfony framework"
@@ -85,6 +82,15 @@ help:
8582
@echo " ${YELLOW}xdebug-check${NC} Check Xdebug configuration"
8683
@echo " ${YELLOW}xdebug-restart${NC} Restart PHP container with Xdebug"
8784
@echo ""
85+
@echo "${GREEN}Documentation commands:${NC}"
86+
@echo " ${YELLOW}apidocs-generate${NC} Generate API documentation"
87+
@echo " ${YELLOW}apidocs-serve${NC} Serve the API documentation via web server"
88+
@echo " ${YELLOW}apidocs${NC} Generate and serve API documentation"
89+
@echo ""
90+
@echo "${GREEN}Container access commands:${NC}"
91+
@echo " ${YELLOW}php-connect${NC} Connect to PHP container shell"
92+
@echo " ${YELLOW}db-connect${NC} Connect to MySQL shell"
93+
@echo ""
8894
@echo "${GREEN}Application directory:${NC}"
8995
@echo " Current application directory: ${YELLOW}$(APP_DIR)${NC}"
9096
@echo " To change, update APP_DIR in .env file or use APP_DIR=<dir> make <command>"
@@ -333,16 +339,6 @@ env-reset: stop
333339
echo "${BLUE}Operation canceled.${NC}"; \
334340
fi
335341

336-
apidoc: check-app-dir
337-
@echo "${BLUE}Generating API documentation for $(APP_DIR)...${NC}"
338-
@if [ ! -d "$(APP_ROOT)/src" ]; then \
339-
echo "${YELLOW}Source directory $(APP_DIR)/src not found!${NC}"; \
340-
exit 1; \
341-
fi
342-
@docker run --rm -v $(shell pwd):/data phpdoc/phpdoc -i=vendor/ -d /data/web/$(APP_DIR)/src -t /data/web/$(APP_DIR)/doc
343-
@$(MAKE) reset-owner dir=$(APP_ROOT)/doc
344-
@echo "${GREEN}Documentation generated!${NC}"
345-
346342
apidocs-generate:
347343
@echo "${BLUE}Generating API documentation for $(APP_DIR)...${NC}"
348344
@if [ ! -d "$(APP_ROOT)/src" ]; then \
@@ -354,6 +350,14 @@ apidocs-generate:
354350
@$(MAKE) reset-owner dir=./docs/api
355351
@echo "${GREEN}Documentation generated in ./docs/api/html!${NC}"
356352

353+
apidocs-serve:
354+
@echo "${BLUE}Starting API documentation server...${NC}"
355+
@$(DOCKER_COMPOSE) --profile dev up -d apidocs
356+
@echo "${GREEN}API documentation available at http://localhost:8081${NC}"
357+
358+
apidocs: apidocs-generate apidocs-serve
359+
@echo "${BLUE}API documentation is now ready and being served.${NC}"
360+
357361
reset-owner:
358362
@chown -R $(CURRENT_USER):$(CURRENT_GID) $(dir) 2>/dev/null || true
359363

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,11 @@ The Makefile provides many helpful commands:
389389
| test | Run tests |
390390
| code-sniff | Check code style with PHP_CodeSniffer |
391391
| phpmd | Analyze code with PHP Mess Detector |
392+
| apidocs-generate | Generate API documentation |
393+
| apidocs-serve | Serve the API documentation via web server |
394+
| apidocs | Generate and serve API documentation |
392395
| gen-certs | Generate SSL certificates |
393396
| enable-ssl | Enable SSL in Nginx configuration |
394-
| apidoc | Generate API documentation |
395397

396398
### Database Management
397399

0 commit comments

Comments
 (0)