Writing Pet-Shop Api using Laravel, in PHP8.2.
- WSL 2 - a compatibility layer for running Linux binary executables natively on Windows 10, Windows 11, and Windows Server 2019.
- Ubuntu - allows access to the Linux terminal on Windows, develop cross-platform applications, and manage IT infrastructure without leaving Windows.
- PHP 8.2 - an interpreted high-level general-purpose programming language
- Docker - a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers.
-
The project has been containerized with the following services included:-
Service Port APP (HTTP) 8000 MySQL 3306 Nginx -
Follow these steps for the initial setup
- Clone the repository
git clone git@github.com:dennismwagiru/pet-shop.git && cd pet-shop
- Build and start server
Go to http://127.0.0.1:8000 to launch Swagger Api Documentation
make install
- Admin Email -> admin@buckhill.co.uk
- Password -> password
- Clone the repository
- Subsequent Runs
make up
- Build docker image
make build
- Stop
make stop
- Run migrations
make migrate
- Seed your database
make seed
- Fresh migrations
make fresh
- Make model field filter
make make-filter
- Enter the name of the Field.
- i.e. to add a filter for user last name enter User/LastName
- Generate Insights
make insights
- Analyse Larastan Level 8 rules for static code coverage
make analyse
-
The application must be written in PHP 8.2
-
The application must use Laravel Framework v.10
-
Every route must be documented using swagger (OpenAPI) so that we can test your backend APIs
-
The application must have at least 10 unit or feature tests
-
The application must use a JSON Web Token implemented with a middleware
- Implemented HS256 for Token Signing/Verification
- The token must be compliant with the RFC 7519 standard
- Implemented HS256 for Token Signing/Verification
-
The application must include a README.md
-
The application must run “out-of-the-box.”
- We will follow the steps provided on the README.md file, such as booting the application from a shell script.
-
The code must be pushed into your personal repository, which is available to us.
- We really want to see your individual commits :slight_smile:
- Please avoid big commits by breaking them down into smaller and descriptive commits, ideally containing code specific to a feature.
- We really want to see your individual commits :slight_smile:
- The application should have database Migrations and Seeders files
- Every table should have an Eloquent model and relationships (if applicable)
- Every endpoint should have its own controller and request class
- The methods of the controllers must be linked to a route
- Every route should be protected by a middleware (if applicable)
- The application should have unit tests, as well as feature tests for each one of the API endpoints
- The application should follow the PSR-12 standard
-
It would be nice to have a Dockerfile for the application and to be able to boot it with docker-compose or docker run
- Laravel Sail or similar packages are not providing extra points; you should write something yourself to gain an advantage.
-
It would be nice to see a Laravel IDE Helper Generator
-
It would be nice if Larastan Level 8 rules for static code coverage passed successfully
- Still working on reducing the errors
-
It would be nice to have PHP Insights implemented with a minimum score of 75% for each quality gate
✨ Analysis Completed !
Code | Complexity | Architecture | Style |
---|---|---|---|
87.8% | 79.2% | 87.5% | 100 % |
Metric | Score |
---|---|
[CODE] | 87.8 pts within 983 lines |
[COMPLEXITY] | 79.2 pts with average of 1.62 cyclomatic complexity |
[ARCHITECTURE] | 87.5 pts within 43 files |
[MISC] | 100 pts on coding style and 0 security issues encountered |