Skip to content

Commit

Permalink
Move to slope-it organization, change namespace to SlopeIt\Breadcrumb…
Browse files Browse the repository at this point in the history
…Bundle
  • Loading branch information
asprega committed May 19, 2021
1 parent 9f6157c commit 5809782
Show file tree
Hide file tree
Showing 28 changed files with 179 additions and 155 deletions.
17 changes: 0 additions & 17 deletions AndreaSpregaBreadcrumbBundle.php

This file was deleted.

8 changes: 7 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
Copyright (c) 2016 Andrea Sprega
The MIT License (MIT)

Original Copyright (c) 2016 Andrea Sprega
https://twitter.com/asprega

Copyright (c) 2021 Slope s.r.l.
https://www.slope.it

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
Expand Down
31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# AndreaSpregaBreadcrumbBundle
# SlopeItBreadcrumbBundle

[![Latest Stable Version](https://poser.pugx.org/asprega/breadcrumb-bundle/v/stable)](https://packagist.org/packages/asprega/breadcrumb-bundle)
[![Build Status](https://travis-ci.org/asprega/BreadcrumbBundle.svg)](https://travis-ci.org/asprega/BreadcrumbBundle)
[![Total Downloads](https://poser.pugx.org/asprega/breadcrumb-bundle/downloads)](https://packagist.org/packages/asprega/breadcrumb-bundle)
[![License](https://poser.pugx.org/asprega/breadcrumb-bundle/license)](https://packagist.org/packages/asprega/breadcrumb-bundle)
[![Latest Stable Version](https://poser.pugx.org/slope-it/breadcrumb-bundle/v/stable)](https://packagist.org/packages/slope_it/breadcrumb-bundle)
[![Total Downloads](https://poser.pugx.org/slope-it/breadcrumb-bundle/downloads)](https://packagist.org/packages/slope_it/breadcrumb-bundle)
[![License](https://poser.pugx.org/slope-it/breadcrumb-bundle/license)](https://packagist.org/packages/slope_it/breadcrumb-bundle)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/7f13817a-3765-42f5-becb-0990a1219e39/mini.png)](https://insight.sensiolabs.com/projects/7f13817a-3765-42f5-becb-0990a1219e39)

This bundle provides a way to create "dynamic" breadcrumbs in your Symfony applications.
Expand All @@ -13,15 +12,15 @@ This bundle provides a way to create "dynamic" breadcrumbs in your Symfony appli
Composer is the only supported installation method. Run the following to install the latest version from Packagist:

``` bash
composer require asprega/breadcrumb-bundle
composer require slope-it/breadcrumb-bundle
```

Or, if you prefer, you can require any version in your `composer.json`:

``` json
{
"require": {
"asprega/breadcrumb-bundle": "*"
"slope-it/breadcrumb-bundle": "*"
}
}
```
Expand All @@ -42,7 +41,7 @@ class AppKernel extends Kernel
{
$bundles = array(
// ...
new AndreaSprega\Bundle\BreadcrumbBundle\AndreaSpregaBreadcrumbBundle(),
new SlopeIt\BreadcrumbBundle\SlopeItBreadcrumbBundle(),
);
// ...
}
Expand All @@ -61,7 +60,7 @@ public function coolStuffAction()
{
// ...

$builder = $this->get('asprega.breadcrumb.builder');
$builder = $this->get('slope_it.breadcrumb.builder');
$builder->addItem('home', 'home_route');
$builder->addItem('$entity.property', 'entity_route');
$builder->addItem('cool_stuff');
Expand All @@ -77,7 +76,7 @@ public function coolStuffAction()
``` php
<?php

use AndreaSprega\Bundle\BreadcrumbBundle\Annotation\Breadcrumb;
use SlopeIt\BreadcrumbBundle\Annotation\Breadcrumb;

/**
* @Breadcrumb({"label" = "home", "route" = "home_route", "params" = {"p" = "val"}, "translationDomain" = "domain" })
Expand All @@ -101,7 +100,7 @@ class CoolController extends Controller
The last step is to use the following Twig function wherever you want the breadcrumb printed in your template:

``` php
asprega_breadcrumb()
slope_it_breadcrumb()
```

Regardless of the way you used to create the breadcrumb, the result will be something like:
Expand Down Expand Up @@ -161,7 +160,7 @@ Note how you don't have to provide the route parameters (since the current reque
The bundle default template for rendering breadcrumb can be overridden by adding the following lines to the `config.yml` of your application:

``` yml
asprega_breadcrumb:
slope_it_breadcrumb:
template: YourBundle::breadcrumb.html.twig
```
Expand All @@ -171,11 +170,11 @@ However, in your template you'll just have to iterate over the `items` variable
## How to contribute

* Did you find and fix any bugs in the existing code?
* Do you want to contribute a new cool feature?
* Do you think documentation isn't good enough and you think you can improve it?
* Do you want to contribute a new feature?
* Do you think documentation can be improved?

Under any of these circumstances, please fork this repo and create a pull request. I am more than happy to accept contributions!
Under any of these circumstances, please fork this repo and create a pull request. We are more than happy to accept contributions!

## Maintainer

[@andreasprega](https://twitter.com/andreasprega)
[@asprega](https://twitter.com/asprega)
33 changes: 0 additions & 33 deletions Resources/config/services.yml

This file was deleted.

24 changes: 16 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{
"name": "asprega/breadcrumb-bundle",
"name": "slope-it/breadcrumb-bundle",
"description": "A bundle for generating dynamic breadcrumbs in Symfony applications",
"type": "symfony-bundle",
"license": "MIT",
"keywords": [
"Breadcrumb",
"Breadcrumbs",
"Symfony",
"Bundle"
"Bundle",
"slope",
"slope.it"
],
"authors": [
{
"name": "Andrea Sprega",
"email": "[email protected]",
"role": "Developer"
"email": "[email protected]",
"role": "Software engineer"
}
],
"require": {
Expand All @@ -25,17 +27,23 @@
"twig/twig": "^2.10|^3.0"
},
"require-dev": {
"mockery/mockery": "1.3.1",
"phpunit/phpunit": "8.5.13"
"mockery/mockery": "1.4.3",
"phpunit/phpunit": "9.5.4"
},
"autoload": {
"psr-4": {
"AndreaSprega\\Bundle\\BreadcrumbBundle\\": ""
"SlopeIt\\BreadcrumbBundle\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"SlopeIt\\Tests\\BreadcrumbBundle\\": "tests"
}
},
"archive": {
"exclude": [
"/Tests"
".github",
"/tests"
]
},
"config": {
Expand Down
31 changes: 9 additions & 22 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit
colors = "true"
convertErrorsToExceptions = "true"
convertNoticesToExceptions = "true"
convertWarningsToExceptions = "true"
bootstrap = "vendor/autoload.php" >

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
bootstrap="vendor/autoload.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<testsuites>
<testsuite name="BreadcrumbBundle for the Symfony Framework">
<directory>./Tests</directory>
<testsuite name="Tests">
<directory>tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>.</directory>
<exclude>
<directory>./Resources</directory>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>

</phpunit>
27 changes: 27 additions & 0 deletions phpunit.xml.dist.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit
colors = "true"
convertErrorsToExceptions = "true"
convertNoticesToExceptions = "true"
convertWarningsToExceptions = "true"
bootstrap = "vendor/autoload.php" >

<testsuites>
<testsuite name="BreadcrumbBundle for the Symfony Framework">
<directory>./Tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>.</directory>
<exclude>
<directory>./Resources</directory>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>

</phpunit>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace AndreaSprega\Bundle\BreadcrumbBundle\Annotation;
namespace SlopeIt\BreadcrumbBundle\Annotation;

/**
* @Annotation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace AndreaSprega\Bundle\BreadcrumbBundle\DependencyInjection;
namespace SlopeIt\BreadcrumbBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
Expand All @@ -12,7 +12,7 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$builder = new TreeBuilder('asprega_breadcrumb');
$builder = new TreeBuilder('slope_it_breadcrumb');
$builder->getRootNode()
->children()
->scalarNode('template')->defaultValue('@AndreaSpregaBreadcrumb/breadcrumb.html.twig')->end()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
<?php

namespace AndreaSprega\Bundle\BreadcrumbBundle\DependencyInjection;
namespace SlopeIt\BreadcrumbBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* Loads the service definitions.
*/
class AndreaSpregaBreadcrumbExtension extends Extension
class SlopeItBreadcrumbExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function getAlias()
{
return 'asprega_breadcrumb';
return 'slope_it_breadcrumb';
}

/**
Expand All @@ -30,6 +27,6 @@ public function load(array $configs, ContainerBuilder $container)

$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$container->setParameter('asprega_breadcrumb.template', $config['template']);
$container->setParameter('slope_it_breadcrumb.template', $config['template']);
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace AndreaSprega\Bundle\BreadcrumbBundle\EventListener;
namespace SlopeIt\BreadcrumbBundle\EventListener;

use AndreaSprega\Bundle\BreadcrumbBundle\Annotation\Breadcrumb;
use AndreaSprega\Bundle\BreadcrumbBundle\Service\BreadcrumbBuilder;
use SlopeIt\BreadcrumbBundle\Annotation\Breadcrumb;
use SlopeIt\BreadcrumbBundle\Service\BreadcrumbBuilder;
use Doctrine\Common\Annotations\Reader;
use Symfony\Component\HttpKernel\Event\ControllerEvent;

Expand Down
2 changes: 1 addition & 1 deletion Model/BreadcrumbItem.php → src/Model/BreadcrumbItem.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace AndreaSprega\Bundle\BreadcrumbBundle\Model;
namespace SlopeIt\BreadcrumbBundle\Model;

/**
* Acts as a "temporary" model which keeps information for the processor to manipulate. Will ultimately be turned into
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace AndreaSprega\Bundle\BreadcrumbBundle\Model;
namespace SlopeIt\BreadcrumbBundle\Model;

/**
* The final model containing the translated label and the URL (optional) related to a breadcrumb item.
Expand Down
33 changes: 33 additions & 0 deletions src/Resources/config/services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
services:
slope_it.breadcrumb.listener:
class: SlopeIt\BreadcrumbBundle\EventListener\BreadcrumbListener
tags:
- { name: kernel.event_listener, event: kernel.controller, method: onKernelController }
arguments:
- '@slope_it.breadcrumb.builder'
- '@annotation_reader'

slope_it.breadcrumb.builder:
class: SlopeIt\BreadcrumbBundle\Service\BreadcrumbBuilder
arguments:
- '@slope_it.breadcrumb.item_factory'

slope_it.breadcrumb.item_factory:
class: SlopeIt\BreadcrumbBundle\Service\BreadcrumbItemFactory

slope_it.breadcrumb.item_processor:
class: SlopeIt\BreadcrumbBundle\Service\BreadcrumbItemProcessor
arguments:
- '@property_accessor'
- '@translator'
- '@router'
- '@request_stack'

slope_it.breadcrumb.twig_extension:
class: SlopeIt\BreadcrumbBundle\Twig\BreadcrumbExtension
arguments:
- '@slope_it.breadcrumb.builder'
- '@slope_it.breadcrumb.item_processor'
- '%slope_it_breadcrumb.template%'
tags:
- { name: twig.extension }
File renamed without changes.
Loading

0 comments on commit 5809782

Please sign in to comment.