Download the PHP package pug-php/pug-symfony without Composer

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

Pug-Symfony

Latest Stable Version GitHub Actions StyleCI Test Coverage

Pug template engine for Symfony

This is the documentation for the ongoing version 3.0. Click here to load the documentation for 2.8

Install

In the root directory of your Symfony project, open a terminal and enter.

When you are asked to install automatically needed settings, enter yes.

It for any reason, you do not can or want to use it, you will have to add to your config/bundles.php file:

Usage

Create Pug views by creating files with .pug extension in templates such as contact.pug:

Then inject Pug\PugSymfonyEngine to call it in your controller:

Or alternatively you can use \Pug\Symfony\Traits\PugRenderer to call directly ->render() from any method of a controller (or service):

No matter if your controller extends AbstractController as it can also render twig views, so it will just work the same as before rather you ->render('view.html.twig') or ->render('view.pug').

Note: standard Twig functions are also available in your pug templates, for instance:

As per https://symfony.com/doc/current/forms.html

Pass the FormView as usual from the controller:

Configure

You can inject Pug\PugSymfonyEngine to change options, share values, add plugins to Pug at route level:

If you use the PugRenderer trait, you don't need to inject the service again and can just use $this->pug.

Same can be run globally on a given event such as onKernelView to apply customization before any view rendering.

See the options in the pug-php documentation: https://phug-lang.com/#options

Initial options can also be passed in parameters in your config/services.yaml:

Note: you can also create a config/packages/pug.yaml to store the Pug settings.

Globals of Twig are available in Pug views (such as the app variable to get app.token or app.environment) and any custom global value or service you will add to twig.yaml:

Make the translator available in every view:

Keys (left) passed to globals are the variable name to be used in the view, values (right) are the class name (can be '@\App\MyService') or the alias to resolve the dependency injection. It can also be static values such as ga_tracking: 'UA-xxxxx-x'.

If you need more advanced customizations to be applied for every Pug rendering, you can use interceptor services.

Then the interceptor would look like this:

As services, interceptors can inject any dependency in their constructor to use it in the intercept method:

And interceptors are lazy-loaded, it means in the example above, neither PugInterceptor nor MyOtherService will be loaded if they are not used elsewhere and if the current request does not end with a pug rendering (pure-Twig view, API response, websocket, etc.) so it's a good way to optimize things you only need to do before pug rendering.

Deployment

In production, you better have to pre-render all your templates to improve performances using the command below:

Security contact information

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.


All versions of pug-symfony with dependencies

PHP Build Version
Package Version
No informations.
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 pug-php/pug-symfony contains the following files

Loading the files please wait ....