Download the PHP package davodm/dgcontent-ci without Composer

On this page you can find all versions of the php package davodm/dgcontent-ci. 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 dgcontent-ci

DG Content for Codeigniter 4

A robust CodeIgniter 4 package to interact with the DGTTeam Content API, featuring caching mechanisms, secure API key management via environment variables.

Features

Prerequisites

Before integrating DGContent into your project, ensure you have the following:

Installation

You can install the package via Composer. Run the following command in your CodeIgniter 4 project directory:

Configuration

  1. Environment Variables Store sensitive information like the API key in your .env file to keep it secure and out of version control.

Add the following entries to your .env file:

  1. Configuration File The package comes with a configuration file located at src/Config/DGContentCI.php. You can customize default settings by modifying this file if necessary.

Usage

You can initialize the library directly in your controller.

Functions

The package provides the following functions to interact with the DGTTeam Content API:

getPosts($params)

Fetch posts based on the specified parameters and return total (as total number for pagination) and posts array.

Parameters:

Returns: An array with total (total number of posts) and posts array containing post objects.

getPost($params)

Fetch a single post by ID or slug and return the post object.

Parameters:

Returns: A single post object.

getPage($slug)

Fetch a single page by slug and return the page object.

Returns: A single page object.

getCategories(bool $websiteOnly = false)

Fetch all available categories. If $websiteOnly is set to true, it will only return categories that are attached to the website specified in the environment variables.

Returns: An array of category objects.

updateStats(string $type, string $id, int $count=1)

Update post statistics (views, likes, dislikes).

Parameters:

Returns: true if the statistics are updated successfully, false otherwise.

setCacheDuration(int $duration)

Set the cache duration for API responses in seconds.

setProcessResult(bool $processResult)

Set whether to process the API response before returning it. Default is true.

clearCache()

Clear the cache for the API responses.

Post Object

The post object returned by the getPosts and getPost functions contains the following properties, which may vary based on the API response:

Error Handling

The package gracefully handles API errors and logs them for debugging purposes. If an error occurs during API requests, the package will throw an exception with a meaningful error message and you can catch it in your application to log or display the error.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Davod Mozafari - Twitter


All versions of dgcontent-ci with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
codeigniter4/framework Version ^4
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 davodm/dgcontent-ci contains the following files

Loading the files please wait ....