Skip to content

Framework X is a simple and fast micro framework based on PHP. I've created a simple CRUD application to understand how it works. I used twig and I created a custom middleware to handle PUT, DELETE methods.

License

Notifications You must be signed in to change notification settings

mahmutbayri/framework-x-database-crud

Repository files navigation

Framework X CRUD

Installation

mkdir framework-x-database-crud
cd framework-x-database-crud
git clone [email protected]:mahmutbayri/framework-x-database-crud.git .
composer install
php migrate.php

Live demo

http://3.68.213.252:3000/tasks

Depending on when your visit the address might not work.

Running on local

X_LISTEN=0.0.0.0:3000 php public/index.php

// with watcher
X_LISTEN=0.0.0.0:3000 ./vendor/bin/php-watcher --watch src --watch resources public/index.php --ext=php,twig

Navigate: http://localhost:3000/tasks

Running on local with docker

Test

docker run \
-e X_LISTEN=0.0.0.0:3000 \
-it --rm --name my-running-script \
-v "$PWD":/var/www/html \
-p 3000:3000 \
-w /var/www/html \
php:8.2-cli \
sh -c "docker-php-ext-configure pcntl --enable-pcntl && docker-php-ext-install pcntl && php migrate.php && ./vendor/bin/php-watcher --watch src --watch resources public/index.php --ext=php,twig"

Prod

docker image rm -f framework-x-database-crud && docker build -t framework-x-database-crud --file DockerfileProd .
docker container rm -f framework-x-database-crud-container && sleep 3 && docker run --name framework-x-database-crud-container -d -p 3000:3000 -e X_LISTEN=0.0.0.0:3000 framework-x-database-crud

// Clean up
docker container rm -f framework-x-database-crud-container
docker image rm -f framework-x-database-crud

Navigate: http://localhost:3000/tasks

Performance

On a MacBook Pro 2,4 GHz 8-Core Intel Core i9

hey -n 5000 -c 100 URL
URL Requests/sec
http://localhost:3000/tasks 2056
http://localhost:3000/tasks/create 2334
http://localhost:3000/tasks/1 2078
http://localhost:3000/tasks/1/edit 2060

Screenshots

List the tasks

http://localhost:3000/tasks

Create a task

http://localhost:3000/tasks/create

Show a task

http://localhost:3000/tasks/1

Edit a task

http://localhost:3000/tasks/1/edit

About

Framework X is a simple and fast micro framework based on PHP. I've created a simple CRUD application to understand how it works. I used twig and I created a custom middleware to handle PUT, DELETE methods.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published