ahmedosama / php-api
Make an API for your application using PHP
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >=8.0
- vlucas/phpdotenv: ^5.6
This package is auto-updated.
Last update: 2024-11-21 11:55:51 UTC
README
- This is a simple php-api project to make an API for your application using PHP native.
REQUIRMENTS
- PHP v8.0 or higher.
- composer
Download and install
git clone https://github.com/ahmed-osama2022/php-api
cd php-api
composer install
- Then serve the public folder
# if you're using php-cli
php -S localhost:8000 -t public
example of .env file
- You should put your
.env
file at the root folder in the project.
DB_HOST= DB_NAME= DB_PORT= DB_USER= DB_PASS=
Check if it is working fine
-
If you start serving the project you should see this welcome page at your serving link.
How to work with?
NOTE: This library uses MVC
in the structure.
NOTE: This project uses psr-4 autoloader
for the src
and App
folder.
-
Put all your credentials for the database in the
.env
file. -
Define all your routes as explained in the
src/Router.php
file. -
You will see an example in the files to tell you How to use it fine.
-
Start making the logic of your application as contrllers you defined in the
App/controllers
folder.