Jump to content

Should slim be used for normal website navigation instead of complicated apache redirects?


Recommended Posts

I recently tried http://www.slimframework.com/ to set up a REST API.  Easy.

 

Is there any reason I should use it or some other similar product for a normal website navigation?  Previously, I put complicated (at least to me) regex in my httpd.conf (or .httacces) files to make URLs pretty.  The redirects when using Slim is just to send everything to index.php if it isn't real.

 

Yea, I am sure if volume is high, it isn't ideal, but what about when just starting off?

 

Thanks

I think what you're actually talking about is a routing engine. That's the part of Slim which is responsible for processing pretty URLs. You don't need a completey framework if you just want a router, there are plenty of standalone libraries.

 

Are there any reasons for using a router? You already answered that question yourself: Yes, they let you get rid of low-level URL manipulations.

 

Your remark about performance issues(?) I don't understand. Routers aren't ideal compared to what? The Apache rewrite engine?

I think what you're actually talking about is a routing engine. That's the part of Slim which is responsible for processing pretty URLs. You don't need a completey framework if you just want a router, there are plenty of standalone libraries.

 

Ah, that is exactly what I want.  Thanks!  Do you have any recommendations?  Have you tried any of the following?

 

 

 

Your remark about performance issues(?) I don't understand. Routers aren't ideal compared to what? The Apache rewrite engine?

 

Yes, compared to the Apache rewrite engine.

Ah, that is exactly what I want.  Thanks!  Do you have any recommendations?  Have you tried any of the following?

 

I don't have any specific recommendations. Pick a project which is actively maintained by a group of developers (rather than code from a random website).

 

This is a lot about personal preferences. Do you want your routes in a code or in an external configuration file? Do you want reverse routing, i. e. get URLs from routes?

 

 

 

Yes, compared to the Apache rewrite engine.

 

The native rewrite engine might be slightly faster than running PHP code, but this is just a small part of request processing. In any case, manually maintaining rewrite rules for a non-trivial site is a PITA. I remember one project which actually did that, and everybody regretted it.

 

The only thing you should avoid is passing all requests to the router. Static files should be handled by the webserver itself. But since Slim appearently does that already, I don't see any problem.

Thanks Jacques1,

 

For now, I just wrote my own router.  One of these days, I will start using a framework, and am sure one is built in, so why get married to another.

 

I would expect the Apache rewrite engine is significantly faster and maybe will save a billionth of a second.  Glad I am not the only one who thinks it is a PITA, and I will concede this small performance advantage for less pain.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.