Created
July 2, 2019 11:30
-
-
Save novia713/3cb6544a2fefec5d8db60d4e68ac6551 to your computer and use it in GitHub Desktop.
Loading a Functor class via Composer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "leandro/composer-functor", | |
"description": "test para probar la carga de un functor mediante Composer", | |
"type": "project", | |
"license": "BSD", | |
"authors": [ | |
{ | |
"name": "leandro", | |
"email": "[email protected]" | |
} | |
], | |
"autoload": { | |
"psr-4": { | |
"Acme\\": "src/" | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
$saludo = new Acme\Leandro\Saludo; | |
$saludo("Mariano"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Acme\Leandro; | |
class Saludo { | |
public function __invoke($name){ | |
echo "Hola $name !!"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment