Giter Site home page Giter Site logo

slim-website's Introduction

The Slim Framework Website

This is the repository for the Slim website (slimframework.com).

Want to contribute?

If you spot any errors, typos, or missing information, please submit a pull request.

The documentation style guide

Unless otherwise stated, the documentation follows the AP Stylebook.

Are you a Microsoft Windows user

You need to make sure you have Ruby Devkit Installed (MSYS2).

Building and running the documentation locally

To run this site locally so that you can test your changes:

$ sudo gem install bundler
$ bundle install

Now, run the local Jekyll installation:

$ bundle exec jekyll serve

Then, browse to http://localhost:4000 in your browser of choice.

Editing the site's CSS

The CSS uses Less and is managed by grunt.

Install the tool chain:

$ npm install -g grunt-cli
$ npm install

To change any CSS, edit the appropriate files in assets\less and then run:

grunt

You can also run grunt watch to automatically rebuild when you make CSS changes.

Build instructions for deployment

bundle exec jekyll build

Update the Algolia search database

Ensure you set the environment variable ALGOLIA_API_KEY before running these commands. See algolia docs for more information.

bundle install
bundle exec jekyll algolia

slim-website's People

Contributors

1ma avatar adambro avatar akrabat avatar codeguy avatar dependabot-preview[bot] avatar dependabot[bot] avatar geggleto avatar joebengalen avatar joppuyo avatar l0gicgate avatar lewiscowles1986 avatar llvdl avatar lornajane avatar mathmarques avatar mbohal avatar mnapoli avatar nbayramberdiyev avatar norkunas avatar odan avatar opengeek avatar raphaelstolt avatar rotzbua avatar shahariaazam avatar shahroq avatar silentworks avatar svpernova09 avatar tflight avatar tw2113 avatar veryrichard avatar zamronypj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slim-website's Issues

migration doc enhancements

route middleware with args:
Slim2:

$app->get('/foo/bar', $authorize('whatever'), function () use ($app)

in Slim3

$app->get('/foo/bar', function ($request, $response, $args) use ($app)
...
})->add($authorize('whatever'));

Slim2 container, if having tons of $app-> access in your application:

$app->cache->get(...

in Slim3

$slim = new \Slim\App(....)
$app = $slim->getContainer();
$app->cache->get(...

Next, previous button in user guide

Hi,

If provided, Next, Previous buttons in user guide section at bottom of every page, that will provide smooth navigation, especially for those who are new to slim.

As of now, at the end of a page, one has to scroll up. Also there is no indicator for current page. Making page title bold will solve this.

Thanks

How do i run this locally

Am trying to run this page locally. I've used jekyll server

but it keep returning this error below...

Library/Ruby/Gems/2.0.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:92:in block in materialize': Could not find RedCloth-4.2.9 in any of the sources (Bundler::GemNotFound) from /Library/Ruby/Gems/2.0.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:inmap!'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in materialize' from /Library/Ruby/Gems/2.0.0/gems/bundler-1.10.6/lib/bundler/definition.rb:140:inspecs'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.10.6/lib/bundler/definition.rb:185:in specs_for' from /Library/Ruby/Gems/2.0.0/gems/bundler-1.10.6/lib/bundler/definition.rb:174:inrequested_specs'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.10.6/lib/bundler/environment.rb:18:in requested_specs' from /Library/Ruby/Gems/2.0.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:13:insetup'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.10.6/lib/bundler.rb:127:in setup' from /Library/Ruby/Gems/2.0.0/gems/jekyll-3.0.1/lib/jekyll/plugin_manager.rb:38:inrequire_from_bundler'
from /Library/Ruby/Gems/2.0.0/gems/jekyll-3.0.1/bin/jekyll:13:in <top (required)>' from /usr/local/bin/jekyll:23:inload'
from /usr/local/bin/jekyll:23:in `

'

pleas help me.

Translation to Japanese

Hi. We, my team at a company in Japan, would like to translate your Slim-Website to Japanese as volunteers, so that more Japanese engineers are able to choose Slim framework easily.
If possible, would you create a function which viewers can change language easily such as PHP Manual.

Regex flags in routes

I may just be missing something but there doesn't seem to be a way to add regex flags to my routes IE i for case insensitive.

Slim 3 Upgrade Guide Missing Information

Hi,

I noticed that the upgrade guide for slim3 does not include information about Slim\Slim changing to Slim\App or what happened to Slim::registerAutoloader().

I also can't figure out what happened to the $app->container->singleton(...) stuff. I assume that got changed to $app->getContainer()->offsetSet(...)

Looks like $app->configureMode(...) has also changed.

Migrating strategy for PrettyExceptions.

Route::setDefaultConditions(...) has changed or was removed?

Thanks.

Broken Link

Hi Glenn,

Whilst researching Backbone.js resources to cite on our website, I found one of your links isn’t working.

It's this link that seems to be broken: http://documentcloud.github.com/backbone/, here on this page of your site http://docs.slimframework.com/routing/delete/, using this text "Backbone.js".

Please check out our resource http://wiht.link/backbonejs-intro as it may prove a useful replacement.

Best,
Chris

Link Broken: http://documentcloud.github.io/backbone/

Context:

<p>If you are using <a href="http://documentcloud.github.com/backbone/">Backbone.js</a> or a command-line HTTP client, you may also override the HTTP method by
using the <strong>X-HTTP-Method-Override</strong> header.</p>

Webpage documentation issue

Sorry I'm a stickler for documentation. In your website you note

"We recommend you install the Slim Framework with the Composer dependency manager." Yes super cool but then you do not state how. In gitub though you do... So suggest you add in this important line of text into your homepage to prevent confusion, as I was rather baffled at first by the next sentence on your homepage.

SO INSERT INTO HOMEPAGE:

$ composer require slim/slim "^3.0"
This will install Slim and all required dependencies. Slim requires PHP 5.5.0 or newer.

Better documentation for App Settings

Hey guys.

I was halfway through forking the website to add documentation for \Slim\App construction when I found that the options I was documenting were already laid out in the dependency container docs. This wouldn't have been my first guess as someone new to Slim 3. (Last experience was Slim 2).

I not sure exactly how, but is it possible to give this information a bit of a higher profile on the website?

This isn't a firm stance, I just thought that my initial, pseudo-beginner reaction might prove useful.

Thanks for the cool library πŸ‘

Multiple themes

In Slim v.2.x

$app->view->setTemplatesDirectory("admin/");

My index.php file has path

$view = new \Slim\Views\Twig(
        './public/themes/site'

How set another path to my route group as

$app->group('/admin',.... {
$container['view'] = function ($c) {
        $view = new \Slim\Views\Twig(
            './public/themes/admin',
})

?

Add a license to the documentation

(Please apologise my english)

I wanted to suggest to the team of http://devdocs.io/ to take a look at you're doc to use it in their tool, but they need to be sure that they don't break the documentation license, and as I don't find it anywhere I suppose that there is any actually...

(first issue ever, and not realy comfortable with english, don't hesitate to tell me if I did somethink wrong or if something could be better :-) )

Differentiating PSR 7 vs SlimPHP 3 approches in code snippets in the documentation

Hi There,

I want to suggest that pure PSR 7 alternative snippets be made available in the documentation; like in the snippet below:

<?php
// Create and configure Slim app
$app = new \Slim\App;

// Define app routes
$app->get('/hello/{name}', function ($request, $response, $args) {

    //Using the Slim3 Non PSR-7 write helper method on the Response Object
    return $response->write("Hello " . $args['name']);

    //OR 
    // Strictly sticking to the PSR-7 API for Response Objects
    $response->getBody()->write("Hello " . $args['name']);
    return $response;
});

// Run app
$app->run();

I believe this will allow developers learning Slim 3 to decide if they want to strictly stick to using the PSR-7 APIs for the Request and Response objects, to make swapping out different PSR-7 Implementations of the Request and Response objects, easier.

Thanks

CORS Example does not work

There are some Problems with the second CORS example (after the simple solution) here:
http://www.slimframework.com/docs/cookbook/enable-cors.html

The line $pattern = $request->getAttribute("route")->getPattern(); throws an error if you call an invalid route. If the route does not exist $request->getAttribute("route") is null and then null->getPattern() throws an Error.
Should be at least something like:
$pattern = $request->getAttribute("route") ? $request->getAttribute("route")->getPattern() : null;

Also the second example does not answer to OPTIONS Requests.
You can add the OPTIONS wildcard from the simple example above, but then the pattern is the wildcard and the simple string compare to all routes from the router does never match. So the header would be just set to access-control-allow-methods: OPTIONS, even if GET or POST route exists.

And last the line
return $response->withHeader("Access-Control-Allow-Methods", implode(",", $methods);
is missing a closing bracket at the end.

Update Required Services documentation

We need to document the actual services that need to be in the Container in order for Slim to work. Also stating which objects should be shared and which should be new on each call.

Passing variables from middleware

From: http://help.slimframework.com/discussions/questions/8833-slim-3-pass-variables-from-middleware:

Rob,
That is very easy. Thank you. I couldn't find that method anywhere in the docs. This info might be very helpful to add to the new docs for new people like myself. Perhaps in the Request Helpers section (http://www.slimframework.com/docs/objects/request.html#request-helpers) or the Middleware section > (http://www.slimframework.com/docs/concepts/middleware.html).

Again, thank you,
Sam

On Fri, Nov 06 at 07:09 AM, Rob Allen wrote:

The easiest way is to use the request's attributes:

In middleware:

$request = $request->withAttribute('foo', 'bar');

In route callback:

$foo = $request->getAttribute('foo');

Upgrade guide could be improved

Referring to the upgrade guide here: https://www.slimframework.com/docs/start/upgrade.html

#24 had some good suggestions, and all got implemented except this item:

  • upgrade guide for slim3 does not include information about Slim\Slim changing to Slim\App

Additionally, I noticed the upgrade guide mentions that the route function signature has changed, and specifically shows that the $res and $req parameters have been added to the callback signature. The guide does not, however, mention the important point that the request and response objects are no longer accessible via the $app (\Slim\App) object, which was a (the?) way to access them in 2.x

Here's a sample of some working 2.x code that does not work in 3.x:

    $app->post('/login', function () use ($app, $json_result) { // breaks due to documented signature change
        $username = $app->request->post('username'); // breaks, but not documented
        $password = $app->request->post('password'); // breaks, but not documented

Error caused by line 2: Error\nMessage: Call to a member function post() on null

It wasn't terribly difficult to figure this out, but after reading the upgrade guide, I decided to jump in and got a rude awakening :)

I'd be happy to make these changes, but I've never contributed here before.

Thanks!

misinfo in docs regarding method getQueryParams

i'm new to 3.x so please excuse me if i'm mistaken or misinterpret the docs, it seems getQueryParams is a method of the parent Request class and not the Uri

the relevant section follows:

The PSR 7 Request object's URI is itself an object that provides the following methods to inspect the HTTP request's URL parts:

getScheme()
getHost()
getPort()
getPath()
getBasePath()
getQuery() (returns string)
getQueryParams() (returns associative array)

Auto endpoint documentation

Is there any way to auto generate an overview of all registered "endpoints"?
I don't want to write an API.Doc for myself, instead I want slim to create that for me.

Is there any chance to get a proper overview?

pathFor doc needs updating

$container->router->pathFor('home') instead of $app->router->pathFor('home') when outside of a route's closure, and
$this->router->pathFor('home') from within a route's closure.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.