{"id":18541923,"url":"https://github.com/975l/includelibrarybundle","last_synced_at":"2025-04-09T18:31:20.694Z","repository":{"id":49379929,"uuid":"122618437","full_name":"975L/IncludeLibraryBundle","owner":"975L","description":"IncludeLibraryBundle will let you specify which library and version to include, version can use wildcard \"*\"","archived":true,"fork":false,"pushed_at":"2025-03-03T10:12:59.000Z","size":256,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T10:21:17.639Z","etag":null,"topics":["bootstrap","css","javascript","jquery","libraries","library","symfony","symfony-bundle"],"latest_commit_sha":null,"homepage":"https://975l.com/en/pages/include-library-bundle","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/975L.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":"LaurentMarquet","open_collective":"laurent-marquet","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"https://buymeacoff.ee/laurentmarquet"}},"created_at":"2018-02-23T12:26:45.000Z","updated_at":"2025-03-09T13:37:13.000Z","dependencies_parsed_at":"2024-01-25T21:30:57.687Z","dependency_job_id":"47d1221f-9049-4991-8c4b-e0b24953d77c","html_url":"https://github.com/975L/IncludeLibraryBundle","commit_stats":{"total_commits":64,"total_committers":3,"mean_commits":"21.333333333333332","dds":0.1875,"last_synced_commit":"601ae787c773f99ae6cae9dd6eb8895acb40a88f"},"previous_names":[],"tags_count":65,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/975L%2FIncludeLibraryBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/975L%2FIncludeLibraryBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/975L%2FIncludeLibraryBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/975L%2FIncludeLibraryBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/975L","download_url":"https://codeload.github.com/975L/IncludeLibraryBundle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248087714,"owners_count":21045574,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bootstrap","css","javascript","jquery","libraries","library","symfony","symfony-bundle"],"created_at":"2024-11-06T20:06:44.461Z","updated_at":"2025-04-09T18:31:20.688Z","avatar_url":"https://github.com/975L.png","language":"PHP","funding_links":["https://patreon.com/LaurentMarquet","https://opencollective.com/laurent-marquet","https://buymeacoff.ee/laurentmarquet"],"categories":[],"sub_categories":[],"readme":"# IncludeLibraryBundle\n\n**--- THIS BUNDLE IS NOT MAINTAINED ANYMORE ---**\n\nFed up of having to look to latest, or specifc, version of jQuery, Bootstrap, etc. IncludeLibraryBundle is made for you ;-)\n\nWant to replace this\n\n```html\n    \u003clink\n        rel=\"stylesheet\"\n        type=\"text/css\"\n        href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\"\n        integrity=\"sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u\"\n        crossorigin=\"anonymous\"\u003e\n\n    \u003cscript\n        type=\"text/javascript\"\n        src=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js\"\n        integrity=\"sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa\"\n        crossorigin=\"anonymous\"\u003e\n    \u003c/script\u003e\n```\n\nby this?\n\n```html\n    {{ inc_lib('bootstrap', 'css', '3.3.7') }}\n    {{ inc_lib('bootstrap', 'js', '3.3.7') }}\n```\n\nIncludeLibraryBundle will let you specify which library and version to include, version can use wildcard \"*\". **It will do a lot more**, see \"How to use\" below.\n\nSubresource Integrity are provided, even for the libraries that don't provide them, based on [https://www.srihash.org/](https://www.srihash.org/)\n\nYou can also include [Google Font](https://fonts.google.com), see below.\n\n[IncludeLibraryBundle dedicated web page](https://975l.com/en/pages/include-library-bundle).\n\n[IncludeLibraryBundle API documentation](https://975l.com/apidoc/c975L/IncludeLibraryBundle.html).\n\n## Bundle installation\n\n### Step 1: Download the Bundle\n\nUse [Composer](https://getcomposer.org) to install the library\n\n```bash\n    composer require c975l/includelibrary-bundle\n```\n\n### How to use\n\nIncludeLibraryBundle provide the following Twig extension functions `inc_lib()`, `inc_link()`, `inc_content()` and `inc_font()`\n\n### Include Library - `inc_lib()`\n\nSimply add `{{ inc_lib('library', 'type', 'version', 'params') }}` to your header and that's it!\n\n- library is the name of the library (see below Supported libraries). It is case unsensitive and can have \"-\" or \"_\", if you want to use 'BoOsTrap', it will work ;-).\n- type is `css` or `js` or `local`, also case insensitive.\n- version is the version wanted, it can use wildcard or be omitted to get the latest one.\n- params is the parameters you want to add when calling a javascript.\n\n### Examples\n\n`{{ inc_lib('bootstrap', 'css') }}`: Latest version\n\n`{{ inc_lib('bootstrap', 'css', '3.3.7') }}`: Specific version\n\n`{{ inc_lib('bootstrap', 'css', '3.*') }}`: Wildcard MAJOR version\n\n`{{ inc_lib('bootstrap', 'css', '3.3.*') }}`: Wildcard MINOR version\n\n`{{ inc_lib('bootstrap', 'css', '3.3.3.*') }}`: Wildcard PATCH version\n\n`{{ inc_lib(absolute_url(asset('css/styles.min.css')), 'local') }}`: local file\n\n### Local file\n\nTo include a local file, you need to provide an **absolute url**. **Important** the type is determined by the extension provided in the url, so it has to be '.css' or '.js'. While it's not really useful for `inc_lib()`, it is for `inc_content()` (see below) as it will allow to include the content of the called library in the html, which can be useful when creating PDF files with `wkhtmltopdf` for example.\n\n### Javascript parameters\n\nFor **javascript**, if you need to add some url query parameters, you can do so by calling the fourth argument `params` of `inc_lib()`. Works also for local file.\n\nFor example, Tinymce needs an apiKey, so call it like this: `{{ inc_lib('tinymce', 'js', 'stable', '?apiKey=YOUR_API_KEY') }}`, you simply need to provide the full query parameters, including \"?\" and \"\u0026\" as it will be added to the srcipt call.\n\n### Just get link - `inc_link()`\n\nYou can also use `inc_link` in the same way `{{ inc_link('bootstrap', 'css', '3.*') }}` to get only the href (css) or src (js) part (url). **Does not work for a local file** as it will return the same url as provided.\n\nFor example, Tinymce needs to get the css used on the website to display using those styles, so we need to provide it the url, `inc_link` will do so :\n\n```javascript\n\u003cscript type=\"text/javascript\"\u003e\n    tinymce.init({\n        content_css : [\n            '{{ inc_link('bootstrap', 'css', '3.*') }}',\n        ],\n    //...\n    });\n\u003c/script\u003e\n```\n\n### Get content - `inc_content()`\n\nIf you need to get the content to include, i.e. for `wkhtmltopdf`, you can use the function `inc_content` in the same way `{{ inc_content('bootstrap', 'css', '3.*') }}`. Works also for local file. Content will be wrapped within `\u003cstyle type=\"text/css\"\u003e\u003c/style\u003e` for `css` and `\u003cscript type=\"text/javascript\"\u003e\u003c/script\u003e` for `js`.\n\n### Include Google font - `inc_font()`\n\nAll you have to do is to worry about its name! Find your [Google Font](https://fonts.google.com/), pick its name and call it with `{{ inc_font('FONT_NAME') }}`. That's it! Now you can refer, using the same names in your css files!\n\n## Supported libraries\n\nUse following names and versions (+ wildcard if wanted, as indicated above) in the functions `inc_lib`, `inc_link` or `inc_content`:\nTo find supported versions check the sub-folders of `src/integrities`\n\n- **[Angular](https://angularjs.org) (javascript)**\n- **[Bootstrap](http://getbootstrap.com) (css + javascript)**\n- **[Bootstrap DatePicker](https://github.com/uxsolutions/bootstrap-datepicker) (css + javascript)**\n- **[CookieConsent](https://cookieconsent.insites.com) (css + javascript)**\n- **[jQuery + Slim](https://jquery.com) (javascript)**\n- **[jQueryUI](https://jquery.com/ui) (javascript)**\n- **[FontAwesome + Base + Regular + Brands + Solid](https://fontawesome.com) (css + javascript)**\n- **[Popper](https://popper.js.org) (javascript)**\n- **[React](https://reactjs.org) (javascript)**\n- **[Select2](https://select2.org) (css + javascript)**\n- **[Tinymce](https://www.tinymce.com) (javascript)**\n\n## How to add libraries and/or versions\n\n- Go into the folder `Libraries`,\n- Open the library class (or add it if not present),\n- Locate the corresponding method `getCss()` or `getJavascript()`,\n- If you add new Library, add method `getVersion()`,\n- Add versions and wildcards to the methods `getVersion()`, keeping the latest above,\n- Add the needed data (take example on existing ones).\n\nFeel free to make PR's to add other libraries/versions :-)\n\nIf this project **help you to reduce time to develop**, you can sponsor me via the \"Sponsor\" button at the top :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F975l%2Fincludelibrarybundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F975l%2Fincludelibrarybundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F975l%2Fincludelibrarybundle/lists"}