Last active
September 20, 2019 20:31
-
-
Save JWPapi/9acc3b1fba626ff4d7ca0d6998353e6e to your computer and use it in GitHub Desktop.
This file contains 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
<VirtualHost *:80> | |
ServerName igbot.lifestyle.cool | |
ServerAlias igbot.lifestyle.cool | |
DocumentRoot /var/www/html/igbot_saas/public | |
DirectoryIndex /index.php | |
<Directory /var/www/html/igbot_saas/public> | |
AllowOverride None | |
Order Allow,Deny | |
Allow from All | |
FallbackResource /index.php | |
</Directory> | |
# uncomment the following lines if you install assets as symlinks | |
# or run into problems when compiling LESS/Sass/CoffeeScript assets | |
# <Directory /var/www/project> | |
# Options FollowSymlinks | |
# </Directory> | |
# optionally disable the fallback resource for the asset directories | |
# which will allow Apache to return a 404 error when files are | |
# not found instead of passing the request to Symfony | |
<Directory /var/www/project/public/bundles> | |
FallbackResource disabled | |
</Directory> | |
ErrorLog /var/log/apache2/project_error.log | |
CustomLog /var/log/apache2/project_access.log combined | |
# optionally set the value of the environment variables used in the application | |
#SetEnv APP_ENV prod | |
#SetEnv APP_SECRET <app-secret-id> | |
#SetEnv DATABASE_URL "mysql://db_user:db_pass@host:3306/db_name" | |
</VirtualHost> |
This file contains 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 | |
// src/Controller/LuckyController.php | |
namespace App\Controller; | |
use Symfony\Component\HttpFoundation\Response; | |
use Symfony\Component\Routing\Annotation\Route; | |
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | |
use App\Service\MessageGenerator; | |
class LuckyController extends AbstractController | |
{ | |
/** | |
* @Route("/lucky/number") | |
*/ | |
public function new(MessageGenerator $messageGenerator) | |
{ | |
// thanks to the type-hint, the container will instantiate a | |
// new MessageGenerator and pass it to you! | |
// ... | |
$message = $messageGenerator->getHappyMessage(); | |
$this->addFlash('success', $message); | |
// ... | |
return Response('test'); | |
} | |
} | |
?> |
This file contains 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
// src/Service/MessageGenerator.php | |
namespace App\Service; | |
class MessageGenerator | |
{ | |
public function getHappyMessage() | |
{ | |
$messages = [ | |
'You did it! You updated the system! Amazing!', | |
'That was one of the coolest updates I\'ve seen all day!', | |
'Great work! Keep going!', | |
]; | |
$index = array_rand($messages); | |
return $messages[$index]; | |
} | |
} |
This file contains 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
# config/services.yaml | |
services: | |
# default configuration for services in *this* file | |
_defaults: | |
autowire: true # Automatically injects dependencies in your services. | |
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. | |
public: false # Allows optimizing the container by removing unused services; this also means | |
# fetching services directly from the container via $container->get() won't work. | |
# The best practice is to be explicit about your dependencies anyway. | |
# makes classes in src/ available to be used as services | |
# this creates a service per class whose id is the fully-qualified class name | |
App\: | |
resource: '../src/*' | |
exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}' | |
# ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment