Download the PHP package bobimicroweber/stylist without Composer

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

Stylist

About

Build Status

Stylist is a Laravel 5.8+ compatible package for theming your Laravel applications.

Installation

Via the usual composer command:

composer require bobimicroweber/stylist

Then, make sure the Stylist service provider is made available to your application by updating your config/app.php:

'FloatingPoint\Stylist\StylistServiceProvider',

You're now ready to go!

Setting up a theme

In order for Stylist to start using themes, you must register at least one theme with the package, and activate it.

Stylist::registerPath('/absolute/path/to/theme', true);

Your theme should contain a theme.json file, which contains some basic information:

{
    "name": "My theme",
    "description": "This is my theme. There are many like it, but this one is mine."
}

Only one theme can be activated at a time, so multiple calls to activate themes, will simply deactivate the previously activated theme.

So, what happens when you now load views?

How Stylist works

Everytime you register a new theme and activate it, Stylist then becomes aware of a new location to search for views, stylesheets, javascripts and image files. Stylist has a few opinions of how to structure your theme directories as well. The reason for this is so that every theme follows the same approach. For example, when you point Stylist to your theme directory, it should have the following directories (if it needs them):

/public/stylesheets
/public/javascripts
/public/images
/views/

Then, when you make calls like the following:

return View::make('layout.application');

It'll look in your theme's directory: /views/layout/ for application.blade.php. Simple huh?

When dealing with assets, Stylist requires the Illuminate\Html library, but instead of using the HTML class, you use Stylist's Theme facade:

{{ Theme::image('path/to/image.png') }}

This will look for the image in your theme's directory first and foremost: /public/themes/active-theme/images/path/to/image.png

This same approach is applied to your styles, js and any other static assets. Whenever you wish to use theme assets, make sure you use the Theme class.

This means that when you make a call to say, Theme::image, the output url in your HTML will actually look like the following:

/themes/active-theme/images/path/to/image.png

Of course, if you don't want Stylist to manage that for you, simply use the usual HTML facade.

There's one step we're still missing - and that's the publishing of your theme assets. This isn't a necessary step - you can easily just copy your theme's assets from it's directory, into the appropriate directory in the public directory in Laravel 5. You simply need to ensure that before you publish, your themes are available and registered. Service providers are a great place to do this.

public function register()
{
    Stylist::registerPaths(Stylist::discover('/path/to/my/themes'));    
}

Then simply run the publish command:

php artisan stylist:publish

Or, if you want to publish a select theme:

php artisan stylist:publish ThemeName

You'll then have your theme's assets published to their associated directories. It's important to note that the returned array must contain array elements that point to the the THEME directory, not the theme's ASSETS directories. This is because stylist will try to work with the theme and its json file, and publish the required files.

Theme inheritance

Themes can have parent themes. What does this mean? It means that you can request a view, and Stylist will first look to the child theme that you have activated, and work its way up a tree. This is really great if you like a particular theme but want to customise just a single view file.

Defining a parent

It's very easy to define a parent for a theme. You simply define the parent theme inside your theme.json:

"parent": "Another theme"

This will ensure that Stylist will first look in your theme's directories for files and assets, and then look in the parent's theme directories. If your theme's parent also has a parent, then it will continue looking up the tree until it finds the file.

Parents do not need to be activated for your theme to make use of them. Only your theme needs to be activated. However, they do need to be registered. This may be handled by the package that manages your theme, or you can register it yourself.

Stylesheets

Themes can also inherit stylesheets. In order to do this, a child theme must have a stylesheet name that is identical to its parent. If this is the case, then the parent CSS file will be loaded first, followed by the child's css theme. This makes it very easy to create "skins" for themes, by simply overloading certain styles.

Helper methods

Stylist has a few helper methods as well, to ease development.

Theme::url()

When used in a view, this method would return the relative path to a theme's public directory. You can also use it to access any file:

Theme::url('favicon.ico')

All versions of stylist with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
laravelcollective/html Version ~5.5
illuminate/support Version ~5.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 bobimicroweber/stylist contains the following files

Loading the files please wait ....