Download the PHP package daccess1/yii2-tilda-api without Composer

On this page you can find all versions of the php package daccess1/yii2-tilda-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii2-tilda-api

Yii2 Tilda Api

Read in other languages: Русский

Tilda platform api extension for Yii2

This is a fork of nariman924/yii2-tilda-api project, which seems to be abandoned for a couple of years.

Installation

The preferred way to install this extension is through composer.

Either run

or add

to the require section of your composer.json file.

Once the extension is installed, include this in components section of your common/config/main-local.php file:

Apply required migrations

Usage

The two most common goals of this extension are saving Tilda pages to lhe local database and then showing them to the end user. The following instruction shows some common usage patterns for this extension. All examples assume that you are using Gii-generated CRUD.

Saving pages

To render the list of the pages from Tilda project, you can use the renderPageSelect method. It's designed to be used with the ActiveForm generated with Gii, and requires no additional setup by default. Simply replace your form field that stores Tilda page id with this code:

This widget takes all the same values as default ActiveForm input field. You can also set the project ID (integer) as a third parameter. If you don't, the defaultProjectID setting will be used. As the result, the HTML select with listed Tilda pages will be rendered into your form, and it's input will be treated as any other model field.

After selecting the page, you now want to save it to the local storage. In order to do so you should update actionCreate and actionUpdate functions of your Controller like this:

This will save page body HTML code and assets to your local server.

Rendering pages

After your page was saved to the local storage, you can render it with the registerAssets and renderHtml methods of the extension. This will require two steps to implement:

In your controller action register the required assets:

The first parameter is the current \yii\web\Controller instance, and the second one is the Tilda page ID.

Then in your view you can render HTML like this

Webhook

Tilda has an option to notify your app about any pages published in your projects via a webhook. However, it has some restrictions on it's usage (see more in Tilda API docs). One of the ways to implement Webhook would be like this:

Methods

After registering the component and applying required migrations, you can access it's methods anywhere in your code. However, the most common usage case was already described above.

renderPageSelect

Returns ActiveForm-compatible HTML select input, which lists all pages from selected project. If no $projectID is provided the defaultProjectID setting is used instead.

getPage

Saves tilda page and it's assets to the local database. Note: Tilda's default jQuery (1.10.2) is not downloaded (to prevent conflicts with your Yii2 jQuery asset).

registerAssets

Registers page's assets (CSS and JS). The first parameter is the current \yii\web\Controller instance, and the second one is the Tilda page ID.

renderHtml

Returns HTML code of the selected page.

listPages

Returns list of pages in project as array of ['id' => 'title'] arrays. If no $projectID is provided the defaultProjectID setting is used instead.

loadPage

Returns the array of data form the local copy of the page.

Notes

You should consider that current Tilda core css settings conflict with Bootstrap (provided with Yii2 by default). To avoid conflicts, you could either don't use bootstrap.css and Tilda at the same page, or fix box-sizing property of elements in your own stylesheet.

License

This software is licensed under MIT license. For more information see LICENSE.


All versions of yii2-tilda-api with dependencies

PHP Build Version
Package Version
Requires yiisoft/yii2 Version *
yiisoft/yii2-httpclient Version ~2.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package daccess1/yii2-tilda-api contains the following files

Loading the files please wait ....