Download the PHP package samuelgfeller/slim-api-starter without Composer
On this page you can find all versions of the php package samuelgfeller/slim-api-starter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download samuelgfeller/slim-api-starter
More information about samuelgfeller/slim-api-starter
Files in samuelgfeller/slim-api-starter
Package slim-api-starter
Short Description Example project with the slim micro-framework
License MIT
Informations about the package slim-api-starter
Slim starter
[![Latest Version on Packagist](https://img.shields.io/github/release/samuelgfeller/slim-api-starter.svg)](https://packagist.org/packages/samuelgfeller/slim-api-starter) [![Code Coverage](https://scrutinizer-ci.com/g/samuelgfeller/slim-api-starter/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/samuelgfeller/slim-api-starter/?branch=master) [![Build Status](https://scrutinizer-ci.com/g/samuelgfeller/slim-api-starter/badges/build.png?b=master)](https://scrutinizer-ci.com/g/samuelgfeller/slim-api-starter/build-status/master) [![Quality Score](https://img.shields.io/scrutinizer/quality/g/samuelgfeller/slim-api-starter.svg)](https://scrutinizer-ci.com/g/samuelgfeller/slim-api-starter/?branch=master) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/samuelgfeller/slim-example-project/blob/master/LICENSE) [Slim 4](https://www.slimframework.com/) API starter template with a few examples and some essential [features](#features) to help you build a secure and scalable API following 2024 best practices and [SOLID](https://en.wikipedia.org/wiki/SOLID) principles. An extensive [**documentation**](https://samuel-gfeller.ch/docs) explains the [architecture](https://samuel-gfeller.ch/docs/Architecture), components, design choices (i.e. [SRP](https://samuel-gfeller.ch/docs/Single-Responsibility-Principle-(SRP))) and features.Features
- Dependency Injection - PHP-DI
- Database migrations - Phinx
- Validation - cakephp/validation
- Logging - Monolog
- Query Builder - cakephp/database
- Integration testing - PHPUnit
- Error handling
- GitHub Actions - Scrutinizer
- Coding standards fixer - PHP CS Fixer
- Static code analysis - PHPStan
Requirements
- PHP 8.2+
- Composer
- MariaDB or MySQL database
Installation
1. Create project
Navigate to the directory you want to create the project in and run the following command, replacing project-name with the desired name for your project.
This will create a new directory with the specified name and install all necessary dependencies.
2. Set up the database
Open the project and rename the file config/env/env.example.php
to config/env/env.php
and add the local database credentials.
Then, create the database for the project and update the config/env/env.dev.php
file with the name of the database, like this:
After that, create a separate database for testing and update the config/env/env.test.php
file with its name. The name must contain the word "test". There is a safety measure to
prevent accidentally truncating the development database while testing:
3. Run migrations
Open the terminal in the project's root directory and run the following command to create the
demo table user
:
4. Insert demo data
Four demo users can be inserted into the database to test the API response by running the following command:
5. Update GitHub workflows
To run the project's tests automatically when pushing, update the
.github/workflows/build.yml
file.
Replace the matrix value "test-database" with the name of
your test database as specified in config/env/env.test.php
.
If you don't plan on using Scrutinizer, remove the .scrutinizer
file at the root of the project,
otherwise you can follow this
guide
on how to set it up.
Done!
That's it! Your project should now be fully set up and ready to use.
If you are using XAMPP and installed the project in the htdocs
folder, you can access it
in the browser at http://localhost/project-name
.
Or you can serve it locally by running php -S localhost:8080 -t public/
in the project's root
directory.
Support
If you value this project and want to support it, visit the Support❤️ page. (thank you!)
License
This project is licensed under the MIT License — see the LICENSE file for details.
All versions of slim-api-starter with dependencies
monolog/monolog Version ^3
php-di/php-di Version ^7.0
cakephp/database Version ^5
selective/basepath Version ^2.0
nyholm/psr7 Version ^1.5
nyholm/psr7-server Version ^1.1
cakephp/validation Version ^5
fig/http-message-util Version ^1.1
php Version ^8.2
ext-pdo Version *
ext-json Version *