mundschenk-at / php-typography

A PHP library for improving your web typography.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

does't work on laravel 5.8

widg opened this issue · comments

php 7.3

vagrant@homestead:~/code/shy$ php -r "print_r(get_loaded_extensions());"
Array
(
...
    [22] => mbstring
...
	public function shy()
	{
		$settings = new \PHP_Typography\Settings();
		$settings->set_hyphenation( true );
		$settings->set_hyphenation_language( 'en-US' );

		$typo = new \PHP_Typography\PHP_Typography();

		$text1 = '<p>Make sure to place composers system-wide vendor bin directory in your so the laravel executable can be located by your system. </p>';

        $hyphenated_html = $typo->process( $text1, $settings );


		dd($hyphenated_html);
	}

output:

"<p>Make sure to place com­posers sys­tem-wide ven­dor bin direc­to­ry in your so the lar­avel exe­cutable can be locat­ed by your system.&nbsp;</p>"

@widg Since I'm not familiar with Laravel, you'll have to provide additional information on what environment you are having the problem (and what the dd() function does.

Here's the output from my system:

$ php --version
PHP 7.3.5 (cli) (built: May  2 2019 12:40:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies
    with Xdebug v2.7.0, Copyright (c) 2002-2019, by Derick Rethans
    with Zend OPcache v7.3.5, Copyright (c) 1999-2018, by Zend Technologies

$ cat laravel.php 
<?php

require "vendor/autoload.php";

	$settings = new \PHP_Typography\Settings();
	$settings->set_hyphenation( true );
	$settings->set_hyphenation_language( 'en-US' );

	$typo = new \PHP_Typography\PHP_Typography();

	$text1 = '<p>Make sure to place composers system-wide vendor bin directory in your so the laravel executable can be located by your system. </p>';

        $hyphenated_html = $typo->process( $text1, $settings );


	echo htmlentities($hyphenated_html) . "\n";

$ php laravel.php 
&lt;p&gt;Make sure to place com&shy;posers sys&shy;tem-wide ven&shy;dor bin direc&shy;to&shy;ry in your so the lar&shy;avel exe&shy;cutable can be locat&shy;ed by your system.&amp;nbsp;&lt;/p&gt;

@widg You will have to provide additional information, otherwise I can't possibly fix this issue.

You are right, everything works! Thank!