Questions tagged [slim-3]

Slim 3 is the successor to Slim 2, a micro framework for PHP.

Resources

Related tags


For the Ruby template engine use instead.

421 questions
2
votes
1 answer

PHP Slim 3 - Accessing class object instances within a slim route

So I’m learning how to write a Slim 3 PHP authentication app and I'm using an example code structure to get me started. The example code has a file called dependencies.php which has a series of functions that create object instances of other…
SneakyShrike
  • 723
  • 1
  • 10
  • 31
2
votes
1 answer

Android retrofit 2, select video and upload to server

I'm writing programs to try to learn Android. I'm trying to get a video to upload to the server with retrofit. My retrofit works uploading EditText etc. I'm using the same IP address here as I do there. In the code the camera works fine records…
gtcode
  • 47
  • 2
  • 7
2
votes
1 answer

SLIM FRAMEWORK 3: Can't pass variable from middleware to controller

What's wrong with my code? I can't pass variable from my Auth middleware to controller. In controller, the attribute "null". Index: $c = new \Slim\Container($configuration); $api = new \Slim\App($c); $api->group('/', function () use ($api)…
user3700786
  • 149
  • 1
  • 13
2
votes
2 answers

Is it possible to use PHP-DI definitions instead of Eloquents Capsule Managers Built in IoC within Slim 3?

I am currently working on a slim 3 application that is using a php-di bridge to serve dependencies. Everything is working flawlessly within controllers, however, I came across an issue when trying to add dependencies to a model observer. Eloquents…
Derek Gutierrez
  • 628
  • 1
  • 6
  • 16
2
votes
2 answers

Data passing with array format

How to pass data in array format using jquery / slim 3 my code : $.each(data.shortlisted, function(index,element) { // alert(element.job_title); $('#studentlist').append('
Sara Sam
  • 78
  • 10
2
votes
1 answer

Slim framework -creating a route which will return a downloadable file stream

I have created the following Slim Framework route in index.php $app->get('/generatecsv', ShippingCSVGenerator::class . ':generateShippingCSV'); The function generateShippingCSV() is correctly being called, however I would like to return a stream…
pcgben
  • 726
  • 7
  • 24
2
votes
2 answers

Why is Slim Framework's phpErrorHandler not working?

I'm having trouble getting the phpErrorHandler to work. I'm using the latest version of Slim and my server is running PHP 7.1. use \Slim\App as App; use \Psr\Http\Message\ServerRequestInterface as Request; use \Psr\Http\Message\ResponseInterface as…
Mark
  • 1,258
  • 13
  • 25
2
votes
0 answers

Slim 3 Service Layer vs model dependency injection

I'm creating an application using the Slim 3 framework which basically consists of dynamically populating a series of dropdown select statements and then produces a table of calculated data based on the selections. I was originally going to stick to…
2
votes
2 answers

Repository pattern in SLIM 3

Hi I am looking to handle slim repository pattern in the common pattern like: productRepositoryInterface productRepository product ProducCOntroller How do I build that using dependency injection of SLIM I have routing and it goes to the…
Tuz
  • 1,810
  • 5
  • 29
  • 58
2
votes
0 answers

Concatenate twig path in javascript string

I'm working on a PHP site with Slim and Twig-View. Within this site I'm working on live search with Ajax. The idea is for the user to search for a string and for search results to appear as the user types. Everything is working fine so far. I'm able…
cesarcarlos
  • 1,271
  • 1
  • 13
  • 33
2
votes
1 answer

Accessing the Data of a Slim 3 Response Object

I'm using a PHP framework called Slim 3 and I would like to inspect my Response object and I wonder why this is not possible. The official documentation states that a Response` object implements PSR 7 ResponseInterface which allows me to inspect…
Magiranu
  • 299
  • 4
  • 27
2
votes
1 answer

Slim 3 container undefined method when creating custom container function

I'm trying to create custom functions with parameters within my container but everything I do ends up failing. My current code is as folllows: $container['myFunction'] = function($container) { return function($arg) { return $arg; …
Joe Scotto
  • 10,936
  • 14
  • 66
  • 136
2
votes
2 answers

Slim 3 route parameter

I encountered strange square bracket in Slim-Skeleton routes.php $app->get('/[{name}]', function (Request $request, Response $response, array $args) { // Sample log message $this->logger->info("Slim-Skeleton '/' route"); // Render index…
Terry Djony
  • 1,975
  • 4
  • 23
  • 41
2
votes
1 answer

Slim 3 not rendering assets

So I'm trying to render my global stylesheet but I am getting an error [Error] Did not parse stylesheet at 'http://localhost:8888/css/app.css' because non CSS MIME types are not allowed in strict mode. Here is my code: app.twig
user8331511
2
votes
2 answers

How to properly add Red Bean PHP into my project

I'm not very experienced with php projects structure, I found this awesome and simple tutorial: https://arjunphp.com/creating-restful-api-slim-framework/ how to create simple slim rest app. This is actually PHP SLIM's official project structure, my…
Sahbaz
  • 1,242
  • 4
  • 17
  • 39