Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Social Links Bundle Laravel Package

astina/social-links-bundle

View on GitHub
Deep Wiki
Context7

Astina Social Links Bundle

AstinaSocialLinksBundle is basically a wrapper around oscarotero/social-links. Its main purpose is to generate social links based on given provider.

Currently supported providers.

Install

Step 1: Add to composer.json

"require" :  {
    // ...
    "astina/social-links-bundle":"dev-master",
}

Step 2: Enable the bundle

Enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Astina\Bundle\SocialLinksBundle\AstinaSocialLinksBundle(),
    );
}

Usage

Main functionality of this bundle is to generate a social link for given provider and url. It can be used as an twig extension, like in the example below.

Basic usage:

{{ social_link('facebook') }}

Extended usage:

{{ social_link('facebook', 'http://www.astina.ch', {'text': 'Custom text', attributes: {'class': 'custom-share', 'target': '_self'} }, 'Custom link text') }}

This example will return an HTML response which looks like.

<a href="https://www.facebook.com/sharer.php?s=100&amp;p%5Burl%5D=http%3A%2F%2Fwww.astina.ch" class="custom-share" target="_self"></a>

Helper accepts three parameters - provider as string, url as string, options as multidimensional array and link text as string. There you can basically add as many custom attributes as you want.

Options and default values:

'title'   => null
'text'    => null
'options' => array('attributes' => array('target' => '_blank'))
'linkText => null

Template extending

It is also possible to extend a social link template, by simply adding a socialLink.html.twig template in app/Resources/AstinaSocialLinksBundle/views/SocialLinks.

Run tests

bin/phpunit
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel