Giter VIP home page Giter VIP logo

swoole-microfw's Introduction

This is a tiny microframework for building APIs based on Swoole, FastRoute, Doctrine DBAL, Doctrine Migrations, and PHP-DI. It's a work in progress.

Getting Started

You'll need PHP 8.1, make, curl and a recent version of docker + docker-compose. Then, just do:

$ make               # run composer, download extras, etc
$ make test          # run unit tests
$ docker-compose up  # run it

make will tell you if you don't have a required command, but it will not check for the correct versions.

The first start will take a little longer than usual, the following ones should reuse a lot of docker images and caching.

Troubleshooting

There are some additional commands that might help you out:

$ make clean         # Clears caches, removes vendors, etc
$ make distclean     # make clean + clear local configs
$ make vendor        # Re-run the composer routines

Check the Makefile for other internal commands.

There are just a few files and folders you should worry about:

./.env                # Environment Variables
./config/config.php   # Dependeny Injection + Routing
./src/Routes          # Route targets
./src/Migrations      # Doctrine Migrations

Additional Information

The following files are internal and there is no need to edit them unless you're adding a new core component:

./bootstrap.php          # Bootstraps autoload + PHP-DI
./config/cli-config.php  # Doctrine Migrations runner
./config/migrations.php  # Doctrine Migrations configuration
./Dockerfile             # Swoole docker image + wait script
./server.php             # Swoole entrypoint
./phpunit.xml            # PHPUnit Configuration
./src/Application.php    # Router on top of FastRoute
./docker-compose.yml     # Stack of service dependencies

Versions used for development:

  • PHP 8.1.13 (cli)
  • curl 7.87.0
  • Docker version 20.10.22
  • Docker Compose version 2.14.2
  • Linux dev 6.1.1-1 (Manjaro 22.0.0)

The TODO List

  • Logging. We are using error_log() that defaults to outputting to the stderr of the container, but that's not ideal.
  • Caching.
  • Monitoring.
  • Leverage DBAL and support sakila for other DBMSs.
  • Security Hardening. This should not be used in production.
  • Better comments and internal API doc comments.
  • PHP 8.2 support.
  • make unsakila to remove the sakila parts and leave just the framework skeleton.
  • More testing.

swoole-microfw's People

Contributors

alganet avatar

Stargazers

Atmos Maciel avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.