Download the PHP package danielgoerz/fs-code-snippet without Composer

On this page you can find all versions of the php package danielgoerz/fs-code-snippet. 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 fs-code-snippet

EXT: fs_code_snippet

fs_code_snippet is an extension for TYPO3. It implements a content element that enables you to render code snippets of various programming languages. It depends on fluid_styled_content rendering.

It makes use of the T3Editor in the backend and the code snippet library prism.js in the frontend.

Requirements

Installation and Setup

Installing and configuring this extension is pretty straight forward. There are only a few things that can be configured.

Installation

To install the extension, perform the following steps:

Configuration

Most configuration is done via TypoScript constants which are editable in the constant editor in the TYPO3 backend.

Extendability

Per default this extensions only provides a curated subset of programming languages from the huge list supported by prism.js. The main reason for this is to prevent the included JavaScript from being bloated with lots of code you never need. If you however do need support for a programming language not included in the default set, you can add any language yourself. You achieve this by overwriting the TCA for the programming_language field to include more programming_languages and extend the JavaScript with the corresponding syntax highlighter.

To add a new language to the TCA you can use the constant from the included CodeSnippetLanguage Enumeration to get the needed string right. In any extension of yours, create the file Configuration/TCA/Overrides/tt_content.php and add the following code to it:

.. code-block:: php

$GLOBALS['TCA']['tt_content']['columns']['programming_language']['config']['items'][] = ['Python' => \DanielGoerz\FsCodeSnippet\Enumeration\CodeSnippetLanguage::PYTHON];

You can add every language identifier that prism supports. Anyway the T3Editor won't know that syntax and will run in "mixed" mode.

To enable the syntax highlighting in the frontend you need to include the corresponding JavaScript component from prism.js. In case of python this would be components/prism-python.js. You can either download the component from prismjs.com or github or you can use the gulp build shipped with this extension to generate a new all-in-one file.

To do so, go to the extension folder and edit the gulpfile to also include the components you need in the buildJs task (e.g. prismBasePath + 'components/prism-python.js'). Then run

.. code-block:: bash

yarn install
gulp build

Now you should have a FsCodeSnippet.js that supports Python.

Make sure to move the generated FsCodeSnippet.js to your own extension and include it from there. Otherwise it will be overwritten if you update fs_code_snippet at any time in the future.


Made by Daniel Goerz (@b13) with ♥


All versions of fs-code-snippet with dependencies

PHP Build Version
Package Version
Requires typo3/cms-core Version ^9.5.0 || ^10.4.6 || ^11.5
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 danielgoerz/fs-code-snippet contains the following files

Loading the files please wait ....