PHP code example of ski / ski-php

1. Go to this page and download the library: Download ski/ski-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ski / ski-php example snippets



ore\Ski;
 


Use Core\Ski;

$ski = new Ski(__DIR__."/path/to/mySkiPath");
// Without "/" at end

$datas = [..]; // retrieve datas as JSON, Array or object

$ski->template('templateName'); //add template that you need
$ski->data($datas); //add datas to Alpine to front

$ski->render(); //And just ⚡️ !

//example :
$ski->template('articleTemplate');
// set template in /templates/articleTemplate.php

//example :
$datas = Http::get('/api/v1/users')->getJson();

$ski->data($datas);

//$datas = {"posts":[...]}
//$datas = ['posts' => [...]]
//$datas = $posts[42]->content->...

//example :
$ski->render();
html
<!--/templates/blogPage.php-->
<x-article>
	<template x-for="post in datas.posts">
		<x-comment/>
	<template>
</x-article>