Giter Site home page Giter Site logo

strapi's Introduction

Rapidez Strapi

Requirements

A Strapi instance running, configured and filled with content types.

Installation

composer require rapidez/strapi

Add the Strapi url to your .env:

STRAPI_URL=http://localhost:1337

Routes

Register some routes within routes/web.php and use the strapi() helper function to get the data. This function accepts the endpoint as parameter and just calls that endpoint and caches the response. For example:

Route::get('blog', function ($location) {
    return view('strapi.blog', ['data' => strapi('blogs')])
});

Route::get('blog/{slug}', function ($slug) {
    return view('strapi.blog-item', ['data' => strapi('blogs?slug='.$slug)[0]])
});

And use the data in your views. For example with {{ $data->name }} you'll get the content of the name field.

Dynamic zones

When you're using a dynamic zone within your content type you can render them with a Blade directive:

@dynamiczone($data->content)

This tries to render views with the same name as the component and the data will be available with the $data variable.

Cache

By default all responses from Strapi will be cached for 1 hour. You can change that with STRAPI_CACHE in your .env

Automatic cache clearing

You can setup a webhook within Strapi which will be called when something changes. If you configure that with the cache clear url from Rapidez you don't have to worry about content not showing up after changes. See the Rapidez cache docs.

License

GNU General Public License v3. Please see License File for more information.

strapi's People

Contributors

royduin avatar bobwez98 avatar jbclaudio avatar quintenbuis avatar

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.