In mezzio-swoole, which kind of format it shows for table, model?

Against laminas-mvc, mezzio has not a complicate skeleton. There is no rule to set a certain folder for form, tablegateway, entity etc.

If I wanna to build a reusable table model, which kind should I choose, middleware, handler, or just model in src?

I donwloaded all the projects here:
https://docs.mezzio.dev/mezzio/v3/reference/mezzio-projects/
None of them has a databas! I need a demo for showing many aspects of a application to follow, as a newer here. Like have to use database, how and where to build model, form class, paginator, login and authentication etc.

Mezzio is a micro-framework, and primarily provides wiring between a container, routing, templating, and error handling. For everything else, you add it in yourself, generally using Composer.

For database abstraction, you can choose from laminas-db, Doctrine DBAL, or even go full ORM with Doctrine ORM. For pagination, check out laminas-paginator — which provides laminas-db adapters, and for which Doctrine provides adapters. For forms, you can choose from laminas-form, or go a level lower to laminas-inputfilter or marcosh/php-validation-dsl. For authentication and authorization, we have a number of libraries in the Mezzio ecosystem already; see the overview in the documentation landing page.

Generally speaking we recommend creating namespaced “modules” in your application. These live under the src/ tree, and the skeleton provides one for you out-of-the-box (“App”); you can add more by adding sibling directories with corresponding entries in your composer.json file’s autoload.psr-4 rules. How you structure these is up to you; I generally structure them based on responsibility or context, which can vary a ton between applications.

You will have a few things always:

  • a ConfigProvider to wire your services and any namespace-specific configuration.
  • Handlers, which are the endpoints of your application - these do the actual work for any given request, and are ultimately what routes will match to.
  • Middleware, if you have any pre-processing you want to do for a request (e.g., validation, authn, authz, etc.) or post-processing of a response (e.g., adding response headers, calculating signatures, etc.)
  • I often also define commands, if there are things I might want to do to build something during deployment, or for cronjobs. These will tie into laminas-cli configuration, and extend the symfony/console Command class.

For an example, I can point you to my personal website, as the code is public. This application uses mezzio-swoole, so there’s a bit of additional bits and pieces around ensuring certain services are stateless, and to allow dispatching async tasks via Swoole task workers.

thank you! I will learn deep into your code.

Hi Matthew, wonder if you have time to teach me on mezzio-swoole:

I copy a lot of your code to my skeleton, but I got the following error:

44444

Why do you always mix up different topics in one thread?! You regularly hijack your own threads. That helps no one.

And your current problem has nothing to do with Mezzio, Swoole, mezzio-swoole or Laminas. This is a typical problem with PDO and parameter binding: php pdo prepare offset - Google Search

I suggest you write an integration test for your mapper: AFAIK it is not possible (in PDO) to bind parameters in the OFFSET and LIMIT clauses.

Write a test, and you will see the source of the problem more clearly.

sorry, sometime it is hard to figure out the title of a new topic
:zipper_mouth_face: