This repository provides the official project skeleton for building applications with the Miduner Framework.
- Core framework package: miduner/miduner
- Core framework repository: github.com/miduner/framework
The project is designed for PHP 7.4+ and uses static typing features such as type hints and arrow functions.
- PHP
>= 7.4.10 - PHP extensions:
ext-pdoext-readlineext-json
- Composer
Create a new Miduner project:
composer create-project danganh97/miduner:dev-master your-project-folderFrom the project root:
cp .env.example .env
php hustle key:generate
php hustle config:cache
php hustle serveRun with a custom host and port:
php hustle serve --host=192.168.1.1 --port=1997Use --open to open the application in your browser automatically.
Run the following command to view all available commands:
php hustle listphp hustle make:command {CommandName}
php hustle make:controller {ControllerName}
php hustle make:model {ModelName}
php hustle make:request {RequestName}
php hustle make:migration --table={TableName}php hustle config:cache
php hustle key:generate
php hustle jwt:installAfter generating a new key or installing JWT, refresh configuration cache.
php hustle migrate
php hustle migrate:rollback
php hustle db:seedphp hustle exec:query --query="select * from users"
php hustle exec:query --query="select * from users" --test=true
php hustle route:list
php hustle route:list --format=json
php hustle route:list --format=arrayphp hustle live:codeFor help on any command:
php hustle <command> --helpAdd the following entry to your crontab:
* * * * * cd miduner && php hustle schedule:run >> /dev/null 2>&1Example scheduler setup in App\Console\Kernel:
<?php
namespace App\Console;
use App\Console\Commands\ExampleCommand;
use Midun\Console\Kernel as ConsoleKernel;
use Midun\Console\Scheduling\Schedule;
class Kernel extends ConsoleKernel
{
protected array $commands = [
ExampleCommand::class
];
public function schedule(Schedule $schedule): void
{
$schedule->command(ExampleCommand::class)->daily();
$schedule->command(ExampleCommand::class)->weekly();
$schedule->command(ExampleCommand::class)->monthly();
$schedule->command(ExampleCommand::class)->yearly();
$schedule->command(ExampleCommand::class)->dailyAt('13:30');
$schedule->command(ExampleCommand::class)->cron('* * * * *');
$schedule->command(ExampleCommand::class)
->everyMinute()
->output(storage_path('logs/schedule.log'))
->cli('/usr/bin/php');
}
}If PHP is not available locally, you can use Docker:
docker-compose up --build -dThen add the following entry to your hosts file:
127.0.0.1 miduner.local
Official documentation is available at: miduner.com/docs
Contributions are welcome. To enable development mode:
php hustle development:enableOr:
php hustle dev:modeIf you discover a security vulnerability, please email [email protected].
This project is open-sourced under the MIT license.