Questions tagged [slim]
Slim for PHP is a RESTful micro framework for PHP 5 inspired by Sinatra.
2,831
questions
-1
votes
1
answer
19
views
How to grant client credential OAuth 2.0 in slim PHP
I am new and was trying to study API using slim PHP, recently I was introduced to Postman and found out you can test API prior to code which was interesting, and then I got more deep into it and found ...
0
votes
1
answer
36
views
How to Pass Parameters to Middleware in Slim 2?
I'm trying to figure out how to pass parameters to a middleware in slim 2. I have a specific use case where I need to customize the behavior of a middleware based on certain parameters.
Here's an ...
0
votes
1
answer
27
views
How to redirect in Slim 4 Framework?
I'm working with a login system, using Slim 4, and I have a few questions about redirects.
In my applicaction, I have a simple form with two fields: user and password, somethign like this:
login....
0
votes
0
answers
27
views
PHP Slim & WordPress Integration
I have a simple PHP app built using Slim v4 framework. In a nutshell, the app consists of two pages only and it provides a REST API:
<?php
use Slim\Factory\AppFactory;
use Slim\Views\Twig;
use Slim\...
0
votes
0
answers
27
views
Apt update returning error code on container
Folks!
I have used Slim Framework on a container based on this article: https://dev.to/cherif_b/using-docker-for-slim-4-application-development-environment-1opm
I simply download the project from ...
1
vote
2
answers
34
views
Get arguments using Request instance in Slim php
I am trying to get the $args from $request, is there any way to do it, if so how,
here is a sample of what i am doing:
class JwtMiddleware
{
public function __construct($settings)
{
}
...
0
votes
0
answers
13
views
Slim can't find a callable to respond to a request
I have created a Slim 4 app and followed the official guide.
Under public/, I created an index.php:
<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\...
0
votes
1
answer
18
views
Slim 4 Auth Middleware redirect fails
I am trying to use Middleware to redirect unauthenticated users into Google API auth.
If I go directly to the auth system (by going to the /auth route), the Google bit works and the user is sent to my ...
2
votes
1
answer
39
views
Slim php container setup
I am fairly new to slim php, i want to learn about containers but with not much luck, i tried so hard to get it done but still i get nothing.
--api
--src
--Controllers
--HomeController....
1
vote
1
answer
39
views
slim php the requested url not found
I am fairly new to slim php, i have a little problem but i can't seem to find it, The error is coming from xampp which is weird. if i navigate to localhost/db_api/hello it works, but when i add args ...
1
vote
1
answer
31
views
Unable to use container from parent with slim
I am trying to build a project using SLIM and below is my HomeController
HomeController.php
<?php
namespace Controllers;
use DI\Container;
use Psr\Http\Message\ResponseInterface as Response;
use ...
1
vote
0
answers
23
views
Slim Framework: Configuring AWS Load Balancer to Securely Accept Requests without Insecure Middleware Error
I am using the Slim Framework in combination with AWS EC2 instances and an AWS Load Balancer to handle incoming traffic. However, when trying to access the application over HTTPS through the Load ...
0
votes
0
answers
33
views
Slim php, No such file or directory
<?php
use Slim\Factory\AppFactory;
require __DIR__ . '/../vendor/autoload.php';
$containerBuilder = new \DI\ContainerBuilder();
$container = $containerBuilder->build();
AppFactory::...
0
votes
0
answers
33
views
How config Slim 4 in remote CPanel
please a need a help, my application works in localhost but i cannot make work in my cpanel web host.
PHP 8.*
Slim 4.*
The error is a simple statuscode 500.
The app tree:
myDomain
└── api
├── ...
0
votes
0
answers
26
views
Twig form/input without symfony
is there a way to pass the form/input value from twig file to controller without using symfony?
Tried using getQueryParams but it only work if you put a value in the url.
0
votes
1
answer
56
views
FormData not passed to PHP via Ajax request
I'm after such flow:
user selects the file(s)
Ajax request(s) are fire up to the PHP backend
Photo processing
Output on the screen.
I am stuck on the step 2. For some reason, my PHP does not get the ...
0
votes
0
answers
20
views
Failed CSRF check from Vue.js to Slim Framework
I have a problem with sending a form in POST from a frontend in Vue.JS to a backend in Slim Framework.
I don't know slim very well, and I can't find the solution for the CSRF token.
Could anyone give ...
0
votes
0
answers
30
views
php slim 3 how make my endpoint accept only one request at a time other requests should be queued
in php slim 3 framework i want my endpoint accept only one request at a time when first request finished it's processing then the second request should be in process mode and other requests should be ...
0
votes
0
answers
12
views
Additional config for php -S (url rewrite)
I'm using php -S <app>:<port> to run a local development server.
I am planning on using the Slim routing package but for this to work I require url rewrite since it redirects everything to ...
0
votes
0
answers
17
views
How can validate psr-jwt token on api call?
I am using https://github.com/RobDWaller/psr-jwt library in my slim4 application
I want to validate the token on the API call.
How should I do to recive the token and decode it?
Here my code:
public ...
0
votes
0
answers
67
views
RewriteRule in .htaccess not redirecting properly on WAMP Server for login form
I have WAMP Server installed on my Windows computer. I have a system that uses the PHP Slim framework. In my .htaccess file, I have the following redirect rule:
RewriteEngine On
RewriteCond %{...
0
votes
0
answers
45
views
how to resize a image with TCPDF in docker
running in test-problems with TCPDF
i am using docker container in the newest version with ubuntu 22. PHP 8.2
for my deployment of a micro service created with slim-micro-framework.
local I can render ...
0
votes
1
answer
158
views
Slim with PHP-DI: Using a DTO as controller method parameter?
I'm using the PHP Slim Framework V4 to build an API with php-di/slim-bridge to have dependency injection within the controller methods.
What's the best practice when working with DTOs for incoming ...
0
votes
0
answers
64
views
Validate request data via Respect/validation
I'm using Slim PHP Framework and I need to validate POST request payload and I'm using this PHP package Respect-Validation.
The idea that I have array ob objects and I need to validate the data inside ...
0
votes
1
answer
167
views
stripe php example returns TypeError: Argument 1 passed to Dotenv\Dotenv::create() must be an instance of Dotenv\Repository\RepositoryInterface
When i try to use example from here https://github.com/stripe-samples/subscription-use-cases I am getting error:
PHP Fatal error: Uncaught TypeError: Argument 1 passed to Dotenv\Dotenv::create() must ...
0
votes
1
answer
24
views
PHP: Accessing Slim $response object
I am trying to set the $response body within a PHP API as follows:
$content = $this->getPDFService()->createPDF();
$response = $this->app->response->header( 'Content-...
1
vote
0
answers
56
views
FrontAccounting API Module Redirect to login
I'm working with FrontAccounting. On my local environment it works fine with no issues. I have uploaded to ubuntu-server and everything works fine (from browser), the only issue is i cannot access api ...
0
votes
0
answers
22
views
Problem with Slim4, XMLHTTP request works fine in localhost but not on the web
Have tried many permutations and many work on localhost but get 404 error on the web
index.php is in root/public and I have .htaccess in that directory as follows
RewriteEngine On
RewriteCond %{...
0
votes
0
answers
88
views
Phpunit test - Error: Call to a member function group() on null
Using "slim/slim": "^3.1",
Trying to do some phpunit test
Created HealthTest.php under test folder
<?php
namespace Tests\Functional;
class HealthTest extends BaseTestCase {
...
0
votes
0
answers
17
views
Plim. DIrect (inmemory) compilation of slim source to html
I need to compile small pies of slim code to html in python.
I solve this problem with code (just example)
import plim
str = 'div#sum.sum'
plim.compile_plim_source(str, plim.syntax.BaseSyntax())
# ...
0
votes
1
answer
16
views
Volley POST request not working on Android after updating PHP backend to Slim 4
I have a sign in script for our Android app. It uses Volley 1.1.1 and has worked fine for year but after switching our PHP backend from Slim 3 to Slim 4, it's no longer working.
public Map<String,...
0
votes
1
answer
244
views
Dependency Injection inside a service utility class using php-di
In my Slim v4, application, I am setting up the container definitions as below.
$containerBuilder = new ContainerBuilder();
$containerBuilder->useAttributes(true);
$containerBuilder->...
0
votes
1
answer
149
views
Uncaught RuntimeException: Callable does not exist
I am trying a simple Slim application as shown below.
index.php
<?php
use Slim\Factory\AppFactory;
require './vendor/autoload.php';
$app = AppFactory::create();
$app->get('/', [TestController:...
0
votes
1
answer
46
views
Slim Autoloading Exception
I am trying to get my slim application to work, but I get this error:
( ! ) Fatal error: Uncaught RuntimeException: Callable Quiz\Controller\QuizController::index() does not exist in /var/www/html/...
0
votes
0
answers
65
views
PHP Unable to Return curl response
I cannot return the response. I successfully tried this request with Postman. The result is in JSON format already, I want to return JSON. If I mess with the header, the error message returned by the ...
1
vote
0
answers
142
views
SLIM PHP PHINX cannot do a migration to a MySQL container
I am trying to do a migration with PHINX in a database with a MySQL container, but getting the following issue.
PDOException: SQLSTATE[HY000] [2002] Connection refused in /var/www/html/vendor/...
0
votes
0
answers
288
views
Insecure use of middleware over HTTP denied by configuration /tuupola/slim-jwt-auth
I'm using JWT token in my PHP Slim 4 framework. The code is working fine on local machine but when I push the code to google cloud, I'm getting error as Insecure use of middleware over HTTP denied by ...
0
votes
0
answers
47
views
Why this login form sometimes fails?
I have login form that usually works but sometimes it fails. When it fails, it doesnt redirect to good page after entering successful credentials. It redirect to /undefined URL.
I am not able to find ...
0
votes
0
answers
73
views
I can't communicate with the server on flutter 5g mobile lines
my application that I wrote with flutter does not communicate with the server on 5G mobile lines. No problem with 4G and wifi.
Are there any special permissions to use 5G with Flutter? I am using slim ...
-1
votes
1
answer
182
views
How to use Doctrine in rest api built with slim framework and php
I have no idea where my problem is located, first of all I wanted to build rest api with slim framework and doctrine.
but I'm getting this kind of error: error picture
Error: Error: [Semantical Error] ...
0
votes
1
answer
420
views
Display swagger on api route on Slim
I just started with php and Slim framework. My main goal is to generate a RESTful API where I have a /swagger route where I show the API documentation using swagger ui.
This are the steps I followed:
...
0
votes
0
answers
95
views
Problem with Slim Framework V3 routes when deploying using nginx reverse proxy
I'm trying to deploy a Slim v3 project on a dockerized nginx reverse proxy on my dedicated server (let's supose the URL is www.mywebsite.com) and I assigned a 'subdirectory' ussing the reverse proxy (...
0
votes
1
answer
118
views
Slim4 controller autoloaded correctly in localhost but not on remote server ("callable controller does not exist")
I am developing an app with Slim 4 PHP framework for the first time and it works great in localhost, but I have an issue with running it in remote server. I am getting following error when running all ...
0
votes
0
answers
32
views
Data not getting saved in slim framework
I am new to php and trying to set up a simple rest api.
The link to the github repository:
https://github.com/deepmandal7/slim-restapi-crud
I have replaced mysql with postgresql and the credentials ...
0
votes
1
answer
418
views
Changing the language by I18n on ruby on rails - leads to the fact that the language sometimes changes by itself
I made a language change and it works, but sometimes after several page updates, the language changes to another, then back - please help, I don't know what to do here
Method for lang change:
def ...
0
votes
0
answers
109
views
How to launch a composer project into production?
I am using Stripe's subscription use case code exampe (https://github.com/stripe-samples/subscription-use-cases/tree/main/fixed-price-subscriptions) with php-slim, and composer, and vanillajs as the ...
0
votes
0
answers
34
views
How do I align the following label and check box in rails slim file
= simple_form_for [:manage, @program] do |f|
= f.input :page_declined_path
= f.label :customize_terms
= f.check_box :customize_terms
I want to align customize terms and the respective checkbox ...
0
votes
0
answers
175
views
Catch request errors openapi-validation-middleware and change jsooutput
I use this repository hkarlstrom/openapi-validation-middleware to verify incoming and outgoing json requests and responses in my api build on php slim.
I want to rework the error output to another ...
0
votes
0
answers
144
views
Call to an undefined method Slim\Psr7\Response::getParsedBody()
This is my code:
How to solve getParsedBody() error i am getting for post request.
$app->post('/login'), function ($request, $response , $args) {
require_once __ .'/../bootstrap/dbconnection....
2
votes
1
answer
116
views
how can i retrive customer name in stripe php slim
server side
<?php
$app->get('/order', function (Request $request, Response $response) {
$id = $_GET['sessionId'];
$checkout_session = \Stripe\Checkout\Session::retrieve($id);
$...