Installation
Installation
Server Requirements
- PHP >= 8.2
- OpenSSL PHP Extension
- PDO PHP Extension
- Mbstring PHP Extension
- See more in PHP Kernel composer.json and PHP Framework composer.json
Installing PHP Framework
PHP Framework utilizes Composer to manage its dependencies. So, before using PHP Framework, make sure you have Composer installed on your machine.
Install PHP Framework by issuing the Composer create-project command in your terminal:
composer create-project --prefer-dist macropay-solutions/php-framework:^1.0 blog
Serving Your Application
To serve your project locally, you may use the built-in PHP development server:
php -S localhost:8000 -t public
Configuration
All the configuration options for the PHP Framework are stored in the .env file. Once PHP Framework is installed, you should also configure your local environment.
Application Key
The application key is automatically generated and injected into your .env file during the composer create-project process.
Installing Packages
In this framework, package installation requires manual asset copying instead of vendor:publish commands to ensure absolute zero-overhead during boot.
Basic Installation
Step 1: Require Package
composer require my-org/my-package
Step 2: Register Provider (if needed)
Edit bootstrap/app.php and manually register the service provider:
$app->register(\MyOrg\MyPackage\MyPackageProvider::class);
Step 3: Copy Configuration (if package has config/)
cp vendor/my-org/my-package/config/my-package.php config/
Register the configuration in bootstrap/app.php:
if (!$app->configurationIsCached()) {
$app->configure('app');
$app->configure('my-package');
}
Step 4: Copy Views (if package has resources/views/)
mkdir -p resources/views/vendor/my-package
cp -r vendor/my-org/my-package/resources/views/* resources/views/vendor/my-package/
Step 5: Copy Language Files (if package has resources/lang/)
cp -r vendor/my-org/my-package/resources/lang/en/* resources/lang/en/
cp -r vendor/my-org/my-package/resources/lang/es/* resources/lang/es/
Using Package Assets
Views
Reference copied views using dot-notation:
return view('vendor.my-package.invoice', ['order' => $order]);
Translations
Reference copied language files natively:
echo __('my-package.welcome');
Configuration
Access copied config:
$apiKey = config('my-package.api-key');
$ttl = config('my-package.cache.ttl');
Framework Core Packages
These are already copied/published in the php-framework template.
Notifications
mkdir -p resources/views/vendor/notifications
cp -r vendor/macropay-solutions/php-kernel/kernel/Notifications/resources/views/* \
resources/views/vendor/notifications/
Then reference in your mail classes:
return view('vendor.notifications.email', ['data' => $data]);
Pagination
mkdir -p resources/views/vendor/pagination
cp -r vendor/macropay-solutions/php-kernel/kernel/Pagination/resources/views/* \
resources/views/vendor/pagination/