GithubHelp home page GithubHelp logo

aubiplus / seo Goto Github PK

View Code? Open in Web Editor NEW
1.0 4.0 0.0 596 KB

In your view scripts or controller actions, often it is necessary to convert strings to perform well in urls. You can use this helper classes to perform these behaviors for you.

License: MIT License

PHP 100.00%
seo seperator converts-string zend-framework zf2

seo's Introduction

Seo

In your view scripts or controller actions, often it is necessary to convert strings to perform well in urls. You can use this helper classes to perform these behaviors for you.

For example: The string this is just an example will be converted to this-is-just-an-example.

Installation

./composer.phar require aubiplus\seo

Usage

Sample module config:

<?php
return [
    'seo'             => [
        'seperator' => '-',
        'chars'     => [
            '/ä|Ä/' => 'ae',
            '/ö|Ö/' => 'oe',
            '/ü|Ü/' => 'ue'
        ]
    ]
];

Seperator

The defined seperator is used to replace all whitespaces with the given character.

Chars

In the chars section you can define own replacements. As you can see in the sample module config the key is a regular expression which will be replaced by the value.

Use service

$urlService = $serviceManager->get(\Aubiplus\Seo\Service\Url::class);
echo $urlService->create("this is just an example");

Use view helper

echo $this->seoUrl("this is just an example");

Use controller plugin

echo $this->seoUrl("this is just an example");

Questions / support

If you're having trouble with this module feel free and create an issue.

seo's People

Contributors

fabiankoestring avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

seo's Issues

A little fix concerning trailing separators

I saw your module on zfmodules.com and was curious what it does - so I read through the code.

I'm not able to make a pull-request at the moment. So I want to provide a small correction here....

In Line 56 of your Aubiplus\Seo\Service\Url you write:

$string = trim($string, '-');

However this should be

$string = trim($string, $this->config->get('separator'));

Cheers and happy coding,
Alex

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.