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
2 answers

How to get the Response from PHP to AJAX?

To receive the response object from my PHP server I thought you could just put the name of the variable into the success function and work on it. Unfortunately this doesn't work. Is there anything which is wrong with my code? I'm using a framework…
Magiranu
  • 299
  • 4
  • 27
2
votes
2 answers

Slim 3 Class not found (Controller)

I'm currently trying to get familiar with Slim 3 and just want to add a simple controller. Error message: Details Type: Error Message: Class 'app\controllers\HomeController' not found File: C:\xampp\htdocs\slim\app\config\dependencies.php Line:…
Magiranu
  • 299
  • 4
  • 27
2
votes
1 answer

Slim3 PSR-4 autoloader

I am writing Slim3 API, for some reason slim is not loading namespace defined in composer. Here is the project structure. FolderStruc: projectApi - composer.json - src - public - index.php - ProjectName - Api -…
danyal14
  • 367
  • 1
  • 4
  • 18
2
votes
3 answers

Eloquent paginate function in Slim 3 project using twig

How can I use paginate function from Eloquent in Slim 3 project using twig ? This is in my controller : $posts = Sound::paginate(2); $this->container->view->render($response, 'admin/sounds/index.twig', [ 'posts' => $posts ]); This is the view…
Swarovski
  • 581
  • 2
  • 8
  • 25
2
votes
1 answer

how to perform 2 queries within same function using mysql db & slim 3 PHP framework

I am trying to retrieve users that were friend requested in ios app and return them into a friend request list in app. To do this I am using a PHP function that queries the notification table for the user_id it was sent from, then return all all…
NightHawk95
  • 163
  • 3
  • 11
2
votes
1 answer

Get the previous route name or uri in Slim 3

Is there anyway in Slim 3 to get the previous route name or uri, similar to Laravel's back() helper? It doesn't have to be specific to Slim, I am just trying to redirect back to the previous page. Thanks :)
user4912666
2
votes
1 answer

Slim v3 Using Custom Class to add Middleware

I want to add Middleware to my Slim project that checks the ip of the user before allowing them access. My middleware class:
bos570
  • 1,505
  • 2
  • 23
  • 45
2
votes
1 answer

Angular 2 and Slim 3 Cros error

I am curently trying to integrate some Angular 2 frontend with Slim 3 PHP backend. I have the following Angular 2 service: import { Injectable } from '@angular/core'; import { Http, Headers, RequestOptions, Response } from '@angular/http'; import…
2
votes
3 answers

Slim3 exclude route from CSRF Middleware

I'm building a webshop based on the slim3 framework. I need to handle a server-to-server POST-request to confirm if payment was successful. I added csrf to the container like this: $container['csrf'] = function($container) { return new…
Jeff
  • 143
  • 2
  • 11
2
votes
1 answer

PHPMailer send twice emails on slimframework

I have a post function to insert info about the process on database and send email to one recipient. $app->post('/sendemail', function ($request, $response) { //Save info process $message = saveDataBaseInfo(); if ($message == "OK") { …
Vinicius Maciel
  • 101
  • 2
  • 12
2
votes
1 answer

Installing Composer and slim, cant get it to work

So this is my first time trying to install and use composer and other packages. I installed composer and slim 3 on my localhost, and it is working just fine. I then went ahead and installed it with SSH on my remote server. No errors occurred, and…
Naxor
  • 47
  • 9
2
votes
2 answers

Slim Framework v3, getting JSON data via POST issue

I'm am using the Slim Framework v3 and have some problems with accessing the JSON data I'm sending from a browser client to my REST API. Currently I'm using $request->getParsedBody(); to access the data, but all it returns is a string and I don't…
PrototypeX7
  • 154
  • 2
  • 10
2
votes
1 answer

Slim Framework sub routing

I want to use sub routes with Slim Framework v3.2.0 like so: www.test.com/ <-- index page www.test.com/foodtype/ <-- separate page www.test.com/foodtype/page/ <-- subcategory of foodtype As I understand it, only one get can be called. Currently I…
blarg
  • 3,773
  • 11
  • 42
  • 71
2
votes
1 answer

Can't solve the Undefined index: outputBuffering in /vendor/slim/slim/Slim/App.php on line 252 error

I am following the Destructy tutorial and, after setting up and testing out the database connection I get the following error: So far, this are my settings: return [ 'settings' => [ 'displayErrorDetails' => true, ], 'url' => …
Pathros
  • 10,042
  • 20
  • 90
  • 156
2
votes
1 answer

Slim 3: what is HTTP Cache for?

What is HTTP Cache for? How do I use it in Slim 3? But I am not quite sure how this is done in Slim 3: use Slim\Http\Request; use Slim\Http\Response; require_once __DIR__ . '/../vendor/autoload.php'; // Register service provider with the…
Run
  • 54,938
  • 169
  • 450
  • 748