npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

contentio-app-deps

v0.0.7

Published

_(If you read this readme on **npmjs.com**, switch to https://github.com/strategio-digital/contentio-sdk)_

Downloads

2

Readme

contentio-sdk

(If you read this readme on npmjs.com, switch to https://github.com/strategio-digital/contentio-sdk)

About

  • Contentio-SDK is a fully extendable PHP & JS package for creating custom websites that's communicating with the Contentio REST API.

  • You can use it as "server-side-rendering (php)" AND "client-side-rendering (vue.js)" engine for your e-shop or website.

  • If you don't make any changes, the SDK will render a complete e-shop that will look exactly like https://contentio.store

Installation guide

1. For classic usage

You have to clone another repository rokuc-cz

  1. git clone [email protected]:strategio-digital/rokuc-cz.git <my-project>
  2. rm -rf <my-project>/.git
  3. Go to second step in "For contributors" and continue.

2. For contributors

  1. git clone [email protected]:strategio-digital/contentio-sdk.git
  2. ./project.sh serve
  3. ./project.sh app
  4. composer i
  5. composer analyse
  6. yarn && yarn dev

3. After installation

IMPORTANT NOTES FOR OUR CONTRIBUTORS

⚠️💥 Don't forget to yarn publish when you make changes in these 2 files:

    1. package.json
    2. yarn.lock

Examples for classic usage

1. Adding custom config file

In www/index.php

$container = (new Bootstrap())
    ->projectRootPath(__DIR__ . '/../')
    ->configure([
        __DIR__ . '/../vendor/strategio/contentio-sdk/config/app.neon',
        //__DIR__ . '/../config/app.neon' // <--- uncomment this
    ]);

$container->getByType(App::class)->run($container);

2. Overriding routes:

In app/config/app.neon

services:
    #routerFactory: Strategio\Router\RouterFactory # <--- uncomment this

In app/Router/RouterFactory.php

class RouterFactory extends \ContentioSdk\Router\RouterFactory
{
    public function createRoutes(): UrlMatcher
    {
        $routes = parent::createRoutes();
       
        // uncomment this --->
        /*$this->add('article_detail', '/clanky/{slug}', [
            \Strategio\Controller\ArticleController::class, 
            'index'
        ]);*/ 
        
        return $routes;
    }
}

3. Overriding template of any action

In app/Controller/ArticleController.php

class ArticleController extends \ContentioSdk\Controller\ArticleController
{
    #[Template(path: __DIR__ . '/../../view/controller/article.latte')]
    public function index(string $slug): void
    {
        parent::index($slug);
    }
}

4. Making async request to API

public function index(string $slug): void
{
    $this->addRequest('first', 'GET', "article/show-one", [
        'json' => [
            'slug' => $slug,
        ]
    ]);
    
    $this->addRequest('second', 'GET', "article/show-one", [
        'json' => [
            'slug' => $slug,
        ]
    ]);
    
    $responses = $this->dispatchRequests('Article Detail');
    
    // first article as array -->
    $a1 = json_decode($responses['first']->getBody()->getContents(), true);
    
    // second article as array -->
    $a2 = json_decode($responses['second']->getBody()->getContents(), true);
    
    $this->template->articles = [$a1, $a2];
}

5. Creating image thumbnail

{varType ContentioSdk\Component\Thumbnail\ThumbGen $thumbGen}
{var $thumb = $thumbGen->create('<slug>/article/56/test.png', 500, null, 'SHRINK_ONLY', 80)}
<img loading="lazy" src="{$thumb->getSrc()}" width="{$thumb->getWidth()}" height="{$thumb->getHeight()}" alt="...">