Download the PHP package phpcoreapi/phpcoreapi without Composer
On this page you can find all versions of the php package phpcoreapi/phpcoreapi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download phpcoreapi/phpcoreapi
More information about phpcoreapi/phpcoreapi
Files in phpcoreapi/phpcoreapi
Download phpcoreapi/phpcoreapi
More information about phpcoreapi/phpcoreapi
Files in phpcoreapi/phpcoreapi
Vendor phpcoreapi
Package phpcoreapi
Short Description PHP Core API CLI to create PHP API projects with routing, controllers, and database setup
License MIT
Package phpcoreapi
Short Description PHP Core API CLI to create PHP API projects with routing, controllers, and database setup
License MIT
Please rate this library. Is it a good library?
Informations about the package phpcoreapi
PHPCoreAPI Project Setup
1. Web Server Configuration
-
Set your web server root to the 'public' folder of the project. Example paths:
- Apache: DocumentRoot -> /path/to/myapi/public
- Nginx: root -> /path/to/myapi/public
- URL rewriting is required for routing to work properly.
Apache (.htaccess example):
Nginx (server block example):
- Restart the server after changes.
- Visit your project URL to confirm it works.
2. Database Configuration
- File:
app/Core/Database.php -
Update variables with your database credentials:
- Controllers automatically get a private MySQLi connection:
3. Routing
- All routes are in
app/Routes/web.php
Independent routes:
Base route groups:
- You can have multiple base groups like
/author/admin.
4. Controllers
-
Create a controller:
-
Create controller in subfolder:
-
Request helpers:
Request::JsonBody()→ raw JSON stringRequest::JsonData()→ decoded JSON arrayRequest::GetData()→ $_GETRequest::PostData()→ $_POST
- Example:
5. CLI Commands
- Create project:
phpcoreapi create-project myapi - Serve server:
phpcoreapi serve(default 8080) orphpcoreapi serve 2303 - Build production:
phpcoreapi build - Make controller:
phpcoreapi make:controller UserController - Add composer library:
phpcoreapi add guzzlehttp/guzzle
6. Local Development
- Start server:
phpcoreapi serve - Open browser:
http://localhost:8080
7. Production Build
- Run:
phpcoreapi build - Output:
/dist - Install composer optimized:
composer install --no-dev --optimize-autoloader - Set web root to
/dist/public
8. Adding Composer Libraries
- Example:
phpcoreapi add guzzlehttp/guzzle
9. Example API Requests
JSON POST:
Form POST:
GET:
10. Notes
- Always keep web root pointing to 'public'
- Controllers use Request & Database helpers
- Edit
web.phpfor routing only
All versions of phpcoreapi with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.4
The package phpcoreapi/phpcoreapi contains the following files
Loading the files please wait ...