Download the PHP package enesakarsu/shortcode-hunter without Composer

On this page you can find all versions of the php package enesakarsu/shortcode-hunter. 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 shortcode-hunter

shortcode-hunter

The Shortcode Hunter - PHP shortcode class, nested shortcodes and custom shortcodes

Installation

Syntax of shortcodes

Shortcodes are written in square brackets.Every opened shortcodes should be closed. Usage example;

You can send parameters to the shortcodes if you want. Parameters are written in two curly braces. Usage example;

Why do shortcodes use?

You can capture shortcodes in a text and make them do whatever you want.

Example: [post id={{1}}][/post]

We can capture this shortcode in the text and pull the content with an id value of 1 from the database.

Example: [date][/date]

We can create a shortcode named "date" and print the current time in text.

What you (guys)can do is totally up to your imagination.

Usage Example

Creating a shortcode

To create a shortcode, open the shortcode-hunter/src/shortcodes.php file and create the shortcode you want like the example below. While creating the shortcode, we write the name of our shortcode as the first parameter and the name of the function we want to run as the second parameter.

Normal function:

Class method:

Above, we asked it to run the function named "exampleFunction" for the "example" shortcode. Now let's create that function in the shortcode-hunter/src/functions.php file.


NOTE

The first parameter of the function to be created should be $values ​​and the second parameter should be $content. Otherwise, parameters and content cannot be accessed.


Parsing the shortcode

Create an index.php file and include the shortcode-hunter class in the file. Then send some text as a parameter to the shortcode's unparse method.

If I run the index.php file, the output I will get is:

Output: hello

Accessing the content of the shortcode

If I want to access the content of the shortcode;

Output: shortcode

Getting parameters sent to shortcode

[example id={{22}}]shortcode[/example] If we are sending parameters to the shortcode, we can capture them like this;

Output: 22


NOTE

If you echo instead of return in the function that the shortcode will run, it will appear at the very beginning of the text. To avoid this you need to do output buffering.

Example;



All versions of shortcode-hunter with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3
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 enesakarsu/shortcode-hunter contains the following files

Loading the files please wait ....