Download the PHP package sudo/assets without Composer

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

Hướng dẫn sử dụng Sudo Assets

Giới thiệu: Đây là package dùng để quản lý các file assets, quản lý các phiên bản một cách dễ dàng và thuận tiên nhất.

Cài đặt để sử dụng

Publish

Mặc định khi chạy lệnh php artisan sudo/core đã sinh luôn cho package này, nhưng có một vài trường hợp chỉ muốn tạo lại riêng cho package này thì sẽ chạy các hàm dưới đây:

Cách dùng

Để sử dụng thì việc đầu tiên chúng ra phải chèn đoạn mã dưới đây vào layouts master:

Để quản lý các file css/js thì chúng ta sẽ dễ dàng quản lý tại config/SudoAsset.php:

return [
    // Mặc định sẽ là true, assets sẽ được load từ local, 
    // Nếu set offline là false và resource có định nghĩa use_cdn là true thì assets sẽ được load từ cdn
    'offline' => env('ASSETS_OFFLINE', true),

    // Bật hiển thị version, lúc này link tới resource sẽ được nối thêm "?v=1.0" chẳng hạn.
    'enable_version' => true,

    // Version hiển thị khi enable_vesion là true
    'vesion' => '1.0',

    // Các thư viện css mặc định được sử dụng, là key được định nghĩa trong phần resource bên dưới.
    'styles' => [
        //
    ],

    // Các thư viện js mặc định được sử dụng, là key được định nghĩa trong phần resource bên dưới.
    'scripts' => [
        //
    ],

    // Định nghĩa tất cả đường dẫn tới assets.
    'resources' => [
        // Định nghĩa các thư viện css
        'styles' => [
            'style' => [
            // Có cho phép sử dụng cdn hay không, nếu là true thì phải định nghĩa link tới cnd bên dưới
                'use_cdn' => false,
            // Vị trí chèn trên header hay dưới footer lần lượt là top, bottom
                'location' => 'top',
            // Đường dẫn tới thư viện
                'src' => [
            // Đường dẫn local
                    'local' => '/assets/css/style.min.css',
            // Đường dẫn cdn
                    'cdn' => null,
                ],
            // Thuộc tính của thẻ theo dạng [ key => value, key2 => value2 ]
            // VD: "type" => "text/css" thì thẻ link sẽ có thêm thuộc tính "type=text/css"
                'attributes' => [
                type" => "text/css"
            ],
            ],
        ],

        // Định nghĩa các thư viện js
        'scripts' => [
            'jquery' => [
            // Có cho phép sử dụng cdn hay không, nếu là true thì phải định nghĩa link tới cnd bên dưới
                   'use_cdn' => false,
            // Vị trí chèn trên header hay dưới footer lần lượt là top, bottom
                    'location' => 'top',
            // Đường dẫn tới thư viện
                   'src' => [
                // Đường dẫn local
                        'local' => '/assets/libs/jquery/jquery.min.js',
                // Đường dẫn cdn
                        'cdn' => null,
                    ],
            // Thuộc tính của thẻ theo dạng [ key => value, key2 => value2 ]
           // VD: "async" => "" thì thẻ link sẽ có thêm thuộc tính "async"
                   'attributes' => [],
            ],
        ],
    ],
];

Một số hàm hỗ trợ sẵn:

Ngoài việc định nghĩa assets trong file config/assets.php, chúng ta còn có thể thêm/bỏ js, css trực tiếp từ controller:

public function show()
{
    \Assets::addStyle(['key-style-su-dung'])
        ->addScript(['key-script-su-dung'])
        ->removeStyle(['key-style-khong-su-dung'])
        ->removeScript(['key-script-khong-su-dung']);
}

Thêm assets 1 cách trực tiếp mà không cần phải thêm tại config:

\Asset::addDirectly([
    // đường dẫn đến assets, khuyến khich dùng hàm asset()
    ], 'styles', 'top')
    ->addDirectly([
    // đường dẫn đến assets, khuyến khich dùng hàm asset()
    ], 'styles', 'bottom')
    ->addDirectly([
    // đường dẫn đến assets, khuyến khich dùng hàm asset()
    ], 'scripts', 'top')
    ->addDirectly([
    // đường dẫn đến assets, khuyến khich dùng hàm asset()
    ], 'scripts', 'bottom')

All versions of assets 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 sudo/assets contains the following files

Loading the files please wait ....