Questions tagged [mezzio]

Mezzio is a web application and API framework written in PHP and using standards-based middleware.

Mezzio, formerly Expressive, is a web application and API framework written in PHP and using standards-based middleware. It consumes request handlers and middleware, using HTTP messages.

Mezzio is a sub-project of the project.

123 questions
11
votes
3 answers

Missing CORS headers in response from PHP/Apache2

A Zend Expressive project my company is working on is ready to be shipped but in our staging environment we seem to be missing response headers for a CORS pre-flight request. This does not happen in our development environment. We're using…
halfpastfour.am
  • 5,764
  • 3
  • 44
  • 61
6
votes
2 answers

'Package zendframework/zend-diactoros is abandoned, you should avoid using it. Use laminas/laminas-diactoros instead.'

I have only upgraded to Laravel ^6.0 from 5.8*. On running $ composer require laravel/passport I have got error message "Package zendframework/zend-diactoros is abandoned, you should avoid using it. Use laminas/laminas-diactoros instead." I have…
Steven
  • 1,071
  • 15
  • 15
5
votes
4 answers

should i learn zf2 to use zend expressive

For those that have begun playing around with zend expressive, does it require knowledge of zend framework 2? meaning do I have to learn/know zf2 in order to use Expressive? or did they make enough changes where learning zf2 would be…
bcgould04
  • 61
  • 2
4
votes
2 answers

FastRoute Groups in Zend Expressive

I want use route groups for FastRoute in Expressive. Like sample: $router = $app->getContainer()->get(FastRoute\RouteCollector::class); $router->get('/', App\Action\HomePageAction::class); $router->addGroup('/pages', function…
devgkz
  • 41
  • 4
4
votes
1 answer

How can I set up Lazy Loading with ZF3 (no ServiceLocator pattern from anywhere)

I am writing a new ZF2 app. I have noticed that ServiceLocator usage pattern of calling services "from anywhere" has been deprecated from ZF3. I want to write code in mind for ZF3. I was able to set up my Controller to call all dependencies at…
3
votes
0 answers

How to serialize an Entity in laminas/mezzio using doctrine and jms/serializer

We're currently working on an API using laminas/mezzio and I'd like to generate different outputs for the details and list routes. I'm looking for a way to generate the following results: List-Response { "_total_items": 2, "_page": 1, …
Roman
  • 139
  • 12
3
votes
1 answer

zend expressive - zend db

I'm trying to use zend expressive and looking at how to do database stuff now. I was looking at this, but it's not clear. I used composer to install zend-db and it mentioned to add a line in dependencies.global.php and then use container in the…
sparkmix
  • 2,157
  • 3
  • 25
  • 33
3
votes
1 answer

Zend Expressive: how to change layout using Zend View

Zend Expressive defaults to layout template when using Zend View. I note the addTemplate($template) function in PhpRenderer class but where and how to add an alternative template to layout? In a middleware factory of an action, in the action itself,…
Mike A
  • 39
  • 7
2
votes
0 answers

How to use Mezzio -> Session

I add session and session-ext packages to a Mezzio project. After that I get an error: Too few arguments to function Mezzio\Session\SessionMiddleware::__construct(), 0 passed in /var/www/mezzio/vendor/mezzio/mezzio/src/MiddlewareContainer.php on…
2
votes
1 answer

Middleware and authentication with laminas-mvc

I had an old ZF (actually ZF1) application laying around, so i decided to play a little bit with laminas/mezzio to see how it works and if updating would be possible. So as it is an old ZF1 application, laminas-mvc seems the way the go, so i started…
patman
  • 2,780
  • 4
  • 30
  • 54
2
votes
2 answers

Doctrine ODM - float field not working with decimal field

I have a document in doctrine with the field config set to /** @ODM\Field(type="float") */ public $stock_price; and on my mongodb the field has a validation for decimal stock_price: { bsonType: 'decimal', description: 'must be a decimal…
2
votes
1 answer

Matching Param on URL in Custom Router PHP

I'm adding a funcionality to this custom Router and custom Request Class in order to be able to serve pages and json responses. I'm stuck on the router part, where the Route has a parameter in the url like: example.com/apply/{variable} Those are…
Albeis
  • 1,544
  • 2
  • 17
  • 30
2
votes
1 answer

Zend Expressive 2 - REST API (JSON) - Versioning (in header) - FastRoute?

I'm building a Zend Expressive 2 REST API (JSON) and want to directly versioning my API. I use Zend ServiceManager + FastRoute for routing. I found this useful links for REST API versioning and decide to use versioning inside request…
2
votes
1 answer

Zend expressive - php error reporting

I'm trying out zend expressive and this is my config/autoload/zend-expressive.global.php and when I tried to do a request to a path which will go to an action class it returned the error page but I can't see any php error in the apache error log. So…
sparkmix
  • 2,157
  • 3
  • 25
  • 33
2
votes
3 answers

PSR-7 "attributes" on Response object

I'm developing using PSR-7 (with Zend Expressive). I figured out the method ServerRequestInterface::withAttribute() and I was wondering why the object Response doesn't have one. I'd like to pass metadata through middlewares after processing, on…
tornellas
  • 21
  • 3
1
2 3
8 9