All Projects → iazaran → php-mvc

iazaran / php-mvc

Licence: MIT License
PHP MVC ⦿ Dockerized • Composer • RESTful API • Memcached • cron • WebSocket

Programming Languages

PHP
23972 projects - #3 most used programming language
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to php-mvc

Cms
Modular CMS powered by CakePHP
Stars: ✭ 163 (+858.82%)
Mutual labels:  composer, mvc
Silexstarter
Starter app based on Silex framework with mvc and modular arch, scaffold generator, and admin panel
Stars: ✭ 11 (-35.29%)
Mutual labels:  composer, mvc
Crontabmanager
PHP library for GNU/Linux cron jobs management.
Stars: ✭ 113 (+564.71%)
Mutual labels:  composer, cron
Zhong
Reliable, distributed cron.
Stars: ✭ 281 (+1552.94%)
Mutual labels:  memcached, cron
Butterfly
🔥 蝴蝶--【简单】【稳定】【好用】的 Python web 框架🦋 除 Python 2.7,无其他依赖; 🦋 butterfly 是一个 RPC 风格 web 框架,同时也是微服务框架,自带消息队列通信机制实现分布式
Stars: ✭ 82 (+382.35%)
Mutual labels:  memcached, mvc
app
Aplus Framework App Project
Stars: ✭ 338 (+1888.24%)
Mutual labels:  composer, mvc
session
Aplus Framework Session Library
Stars: ✭ 170 (+900%)
Mutual labels:  memcached, composer
cli
Aplus Framework CLI Library
Stars: ✭ 104 (+511.76%)
Mutual labels:  composer, cron
kaabah
A Terraform solution to design, build and operate Docker Swarm infrastructures
Stars: ✭ 29 (+70.59%)
Mutual labels:  cron
adsorber
Ad-blocker for Linux systems purely built on POSIX-compliant shell scripts.
Stars: ✭ 57 (+235.29%)
Mutual labels:  cron
xperience-training-13
Kentico Xperience 13 training website
Stars: ✭ 18 (+5.88%)
Mutual labels:  mvc
EnyimMemcachedCore
A Memcached client for .NET Core. Available on Nuget https://www.nuget.org/packages/EnyimMemcachedCore
Stars: ✭ 143 (+741.18%)
Mutual labels:  memcached
unit-converter
Convert standard units from one to another with this easy to use, lightweight package
Stars: ✭ 104 (+511.76%)
Mutual labels:  composer
server-next
😎 The next generation of RESTful API service and more for Mix Space, powered by @nestjs.
Stars: ✭ 43 (+152.94%)
Mutual labels:  cron
auth
JSON Web Token Authentication for Laravel
Stars: ✭ 12 (-29.41%)
Mutual labels:  composer
RaccoonWP
Modern Architecture Stack and Starter Theme for WordPress
Stars: ✭ 17 (+0%)
Mutual labels:  composer
job-plus
Job Plus项目是基于SpringBoot+Vue的轻量级定时任务管理系统
Stars: ✭ 17 (+0%)
Mutual labels:  cron
mastodon-api-php
PHP wrapper for the Mastodon API.
Stars: ✭ 12 (-29.41%)
Mutual labels:  composer
nodejs-cron-job-must-know
it is an example of running node.js script with every certain period(cron job)
Stars: ✭ 35 (+105.88%)
Mutual labels:  cron
Space
This repository contains sample projects associated with articles I write.
Stars: ✭ 21 (+23.53%)
Mutual labels:  mvc

Dockerized Pure PHP Composer based MVC Framework

Codacy Badge

This project tries to cover some PHP features in a simple MVC structure with minimum installed composer packages. Then developers can use packages for specific requirements. Please add your ideas in Discussions, ask features or report bugs in issues.

💡 TODO: SPL

Features:

List of features related with structure

  • public Contains the index.php file, to start application and configures auto-loading. Different server configurations added into this directory too. Finally, you can find the Sitemap generator that runs after creation or updating a post.
  • public/assets Assets can contain your media files like images, audios & videos.
  • public/css & public/js Contains the styles & scripts (After changes on these files, you can use minifier script to update minified versions, just run docker-compose exec php-mvc-app php minifier.php)
  • public/feed There is a RSS generator in here and runs after creation or updating a post.
  • grpc A simple router for distribute the requests to different services. It is not working yet and I created an issue for it and if you have an idea or a solution, only by PHP for both server and client sides, please add your solution in there.
  • websocket A WebSocket sample. You can open /websocket route in 2 tabs and test the websocket connection.
  • src Contains migrations for a DB and routes.
  • src/App Contains all classes that used in codes like PDO, Middleware, Router & ...
  • src/Console Contains all scripts to run multiple times via Cron Jobs (Scripts should be registered in /commands.php with custom timing, they will run by independent service in docker-compose)
  • src/Controllers Controllers related with your routes separated for web and API. API folder includes both RESTful API and gRPC API. If you want use gRPC (gRPC client & server are not completed, and I ignored them for now. So be careful about the bugs in gRPC and if you have an idea or a solution, only by PHP, please make a new discussion/issue/PR), you can find .proto file in API folder. Updating it will need to generate PHP codes again by
docker-compose exec php-mvc-app protoc -I=src/Controllers/API \
    src/Controllers/API/blog.proto \
    --php_out=src/Controllers/API/gRPC \
    --grpc_out=src/Controllers/API/gRPC \
    --plugin=protoc-gen-grpc=/usr/bin/grpc_php_plugin
  • src/Models Models related with controllers' DB queries & requirements.
  • src/Views Simple PHP files to show data on Frontend with reusable include files.
  • / You can update env variables and composer.json to add custom packages.

Useful Functions:

  • XmlGenerator::feed() Generate sitemap.xml & rss.xml via a script file
  • HandleForm::upload(...) Upload file, resize image & add watermark
  • HandleForm::validate(...) Validation rules
  • HandleFile::write(...) & HandleFile::read(...) Write into and read from file
  • Helper::mailto(...) Send HTML Email
  • Helper::dd(...) Dumps a given variable along with some additional data
  • Helper::log(...) Logging custom data into file
  • Helper::csrf(...) Check Cross-site request forgery token
  • Helper::slug(...) Slugify string to make user-friendly URL
  • Cache::checkCache(...), Cache::cache(...) & Cache::clearCache(...) Check existing cache, cache data and clear cache, by Memcached
  • UserInfo::current() Return current user information
  • UserInfo::info(...) Return selected user information
  • Event::listen(...) & Event::trigger(...) Register an event listener and trigger it when needed

Run Web App:

  • Install docker and docker-compose if needed
  • Uncomment // createTables(); in src/routes
  • Run docker-compose up --build -d
  • Open your browser and open web app in localhost:8080 (It will create tables related with migrations.php and then will comment createTables(); automatically.)
  • You can run docker-compose down to stop and remove containers
  • Next time you can use docker-compose up -d

Use Ajax to send forms' data:

Consider a route for your form like /blog/create; now use blog-create as an ID for form, and blog-create-submit for submit button ID. All form's buttons need to have constant form-button class.

RESTful API samples

Ready to use PostMan collection for RESTful API side:

Run in Postman


Let me know about collaborating: [email protected]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].