Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

#17 upgrade to slim 4 #18

Open
wants to merge 28 commits into
base: slim-4
Choose a base branch
from

Conversation

gustavofabiane
Copy link

#17 Update the application to Slim 4.

Note: I'm opening the PR as draft and will update the readme.md and docs/ soon.

Tests suites are OK, also tested with React + Redux Front End.
Postman collection API Test is running with errors for date format [Article's "createdAt" property is an ISO 8601 timestamp] and also fails in register tests because response attributes doesn't match.

Also found an issue on article list that the articlesCount were resulting an empty set if the OFFSET clause exists in the query builder so I've adjusted it to count the articles before addins the offset clause.

Fixed validation of timestamps in model transformers which were using undefined variable $user

New dependencies:

  • Slim 4
  • PHP-DI
  • Nyholm PSR-7 and PSR-7 Server
  • Phinx fixed in stable instead of master
  • Requires PHP 7.2 or later
  • Requires platform extensions: json, pdo, pdo_mysql, pdo_sqlite

- upgrade required php version to >=7.2
- upgrade slim up to v4.0
- remove slim/php-view since there is no need for templates
- add nyholm/psr7 and nyholm/psr7-server to handle HTTP abstraction
- add PHP-DI for dependency management as substitute of Pimple
- remove service providers
- add boot.php file to start bootable services (db)
- migrate callable middleware to psr-15 interface implementations
- add definitions in container
- fix stable version of phinx
- update JWT middleware to v3 (psr-15)
- update htaccess to handle Authorization header instead of HTTP_AUTHORIZATION
- update functional tests
- update OptionalAuth
- build app from container
- add new home page route without renderer
- indent new settings section
- fix validator declaration
- remove session from validator
- remove slim 3 specific HTTP messages method calls
- JWT in request in an array instead of object
- fix action methods signatures
- fix doc blocks
- all controllers now extends from BaseController
- use getParsedBody() and getQueryParams() to retrieve request data instead of specific 'getParam()' from Slim 3 ServerRequest object
- update response generation with methods from BaseController which uses the application ResponseFactory implementaion
when offset is present the SQL count were returning an empty set, to fix it we have to count the articles before defining the offset clause in query builder
@alhoqbani
Copy link
Collaborator

Thanks @gustavofabiane for your contribution and the great work, and apologies for my delay :(

I run the test suits and run the app with vue frontend, everything works fine.
Unfortunately, I cannot do a full review of your code. It's been a while since I worked on Slim framework.

It would be great if @EricSimons could assign the repo to someone else from the slim community or perhaps @gustavofabiane can take over.

@gustavofabiane gustavofabiane marked this pull request as ready for review February 18, 2020 00:56
@gustavofabiane
Copy link
Author

Hello, I just upgraded the readme.md with the changes that affected some application core, since Slim 4 are decoupled from another libraries (besides FastRoute), the main changes affected the way middleware, settings, routes and dependencies are declared.

PHP-DI also uses autowire so the Container don't need to be injected in controllers. BaseController now has a constructor that resolves the application dependencies, as the project is an example we can keep it simple.

@alhoqbani There still points where we can do some improvements. I don't have much time either but I can contribute whenever I can.

@alhoqbani alhoqbani changed the base branch from master to slim-4 March 17, 2020 22:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants