Symfony 4 + FOSRESTBUNDLE - api

Good Evening. Please i'm using Symfony 4 to create an API. I've installed the FOSRESTBUNDLE but i don't see where i can modify the configuration file of this bundle. Please i'll like to set a configuration like
fos_rest:
view:
#…
view_response_listener: true
In Symfony 2, we do it in app/config/config.yml. Please Where will i do this in Symfony 4?

Look at this article: https://codereviewvideos.com/course/beginners-guide-back-end-json-api-front-end-2018/video/setup-symfony-4-fosrestbundle
Check if you required this bundle with following command:
composer require friendsofsymfony/rest-bundle
If you require it with this command but you still don't see file config/packages/fos_rest.yaml execute following command
composer fix-recipes
If you still don't see this config file, you can just copy-paste it from original recipe repository: https://github.com/symfony/recipes-contrib/tree/master/friendsofsymfony/rest-bundle/2.2/config/packages
Also check that this bundle is included in config/bundles.php

Related

how to remove jetstream and fortify in laravel?

I am trying to remove Fortify and Jetstream packages from Laravel so I removed them from App. Providers, from composer.json (require section), Actions, Config, vendor. Then I run composer update and I get the following message:
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
I also remove sanctium from the same locations
Only remove from composer.json file won't delete them fully. You need to remove and modify some file manually.
Edit away
app/Http/Kernel.php - \Laravel\Jetstream\Http\Middleware\AuthenticateSession::class,
app/Models/User.php - use HasProfilePhoto;
config/app.php - App\Providers\FortifyServiceProvider::class,
config/app.php - App\Providers\JetstreamServiceProvider::class,
routes/web.php - routes with auth:sanctum
Delete
app/Providers/FortifyServiceProvider.php
app/Providers/JetstreamServiceProvider.php
app/View/Components/AppLayout.php
app/View/Components/GuestLayout.php
app/Actions/Fortify/
app/Actions/Jetstream/
config/fortify.php
config/jetstream.php
config/sanctum.php
I'm using Laravel 8. The solution may differ depending on the version.
You May also Clear the bootstrap/cache directory.
see this answer
Firstly Remove the Modified Files From Your Project after that Remove it From your composer.json and run the following Command
composer remove vendor/package
Running the following command will remove the package from vendor composer.json and composer.lock
And After that Run Composer Update thats all

yii creating webapp error

Hi i am trying to create a yii application and i am got this issue tried google but not able to find the solution how can i resolve this,..?
This is my error:
Error: Unsupported VCS specified. Currently only git and hg supported.
And what actually this error is..?
yiic webapp d:\xampp\htdocs should work.
Notice the backslashes.
Or, perhaps better, since the app generator supports relative paths, navigate to d:\xampp and simply run yiic webapp htdocs.
That said: why are you using Yii 1 ?
It is really old, and does not receive any updates.
Yii 2 is so much better :)

Tymon JWTAuth class not found

I want to use laravel for building api.
I installed JWTAuth from installation guide on wiki page. When I want to use vendor:publish, I get this error:
After 3days searching on Google, I can not find a solution that working for me. How can I fix this?
For latest version. Please use following code in providers array in config file
For laravel
Tymon\JWTAuth\Providers\LaravelServiceProvider::class
For Lumen : open app/Providers/AppServiceProvider.php and add the following to the register() method.
$this->app->register(\Tymon\JWTAuth\Providers\LumenServiceProvider::class);
Hope this will help someone.
Simply means you have not added JWTAuthServiceProvider to list of Laravel Service providers.
Go to config/app.php and add JWTAuthServiceProvider to providers list
Like so:
'providers' => [
...
Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
...
]
Secondly since these error occurs only in console run:
composer update --no-scripts
composer update
add "tymon/jwt-auth": "^0.5.12" to composer.json and command
composer update
on app/config.php add this to providers
Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class,
and on app/config.php add this on aliases
'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,
tested on laravel 5.5 and tymon/jwt-auth": "^0.5.12"

Composer needs a proxy to install laravel apparently, where do I get that? can I set it up myself using apache?

I was trying to get started with Laravel just last night, so I tried to install it with composer but it wouldn't go through and kept sayin The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. , so I looked around and found out that you need to tell composer to use a proxy.(q1 q2 q3).
Well now this might sound silly but honestly I had no idea what a proxy was until last night, so I went and studied it a bit and I got this far:
"Proxy means to act on behalf of another. In the context of a Web server, this means
one server fetching content from another server, then returning it to the client"
and apparently there's 2 kinds of proxy: forward proxy and reverse proxy.
In those 3 pages that I just showed, they were saying before runing php bin\composer global require "laravel/installer=~1.1" you have to set an env var like this: set http_proxy=username:password#proxy_server:port
So now my question is: I still don't know where can I get a proxy like that, should I set it up myself with apache? is that gonna even work? what do I do?
Your thoughts would be appreciated, thank you.
Edit: Environment info:
I'm on windows 7
installed xampp-win32-5.6.14-0-VC11-installer
all of those 5 important extensions are all enabled in phpinfo()
the path= C:\Users\UserName\AppData\Roaming\Composer\vendor\bin is set in environment variables
here's a picture of the whole error
here's the result of php -m i.stack.imgur.com/wz030.png
Some stuff that I tried:
I went into these sites: proxy4free.com us-proxy.org proxylist.hidemyass.com ultraproxies.com,
I tried this: set https_proxy=https://xteamweb.com:xteam#75.55.165.86:8088 and this one: set http_proxy=http://1proxy.space and many others from those sites: i.stack.imgur.com/6YWyp.png
but no matter what, this is the result of all of them: i.stack.imgur.com/mqOrP.png
Still nothing...
Ok here's the solution, if you're having the same problem:
1:
Make sure these are all uncommented in php.ini:
extension=php_openssl.dll
extension=php_curl.dll
extension=php_sockets.dll
extension_dir="E:\xampp\php\ext"
browscap="E:\xampp\php\extras\browscap.ini"
Add these 2 lines at the end of php.ini
curl.cainfo=c:\openssl-1.0.2d-win32\ssl\cert.pem
openssl.cafile=c:\openssl-1.0.2d-win32\ssl\cert.pem
2:
Run this: php -r "print_r(openssl_get_cert_locations());"
and you'll get:
Array
(
[default_cert_file] => c:/openssl-1.0.2d-win32/ssl/cert.pem
[default_cert_file_env] => SSL_CERT_FILE
[default_cert_dir] => c:/openssl-1.0.2d-win32/ssl/certs
[default_cert_dir_env] => SSL_CERT_DIR
[default_private_dir] => c:/openssl-1.0.2d-win32/ssl/private
[default_default_cert_area] => c:/openssl-1.0.2d-win32/ssl
[ini_cafile] => c:\openssl-1.0.2d-win32\ssl\cert.pem
[ini_capath] =>
)
3:
Make these folders:
c:\openssl-1.0.2d-win32
c:\openssl-1.0.2d-win32\ssl
c:\openssl-1.0.2d-win32\ssl\certs
c:\openssl-1.0.2d-win32\ssl\private
Download this: http://curl.haxx.se/ca/cacert.pem.
Rename it to cert.pem and put it in c:\openssl-1.0.2d-win32\ssl\.
Rename it to cert.crt and put it in c:\openssl-1.0.2d-win32\ssl\certs\.
So:
c:\openssl-1.0.2d-win32\ssl\cert.pem
c:\openssl-1.0.2d-win32\ssl\certs\cert.crt
4:
Download https://getcomposer.org/Composer-Setup.exe and install it, It will no longer gives u the ERR_CONNECTION error.
Go to c:\users\YOURUSERNAME.
composer.bat should be there, if not create it yourself.
Add c:\users\YOURUSERNAME to your path.
Edit composer.bat and delete what's in it and put this in #php "%~dp0composer.phar" %*.
Download https://getcomposer.org/composer.phar.
Place composer.phar in c:\users\YOURUSERNAME.
5:
Done.
Composer will now install laravel using: composer global require "laravel/installer=~1.1" with no problem.
(Plus: now composer command is available globally instead of using it like: php composer.phar or php bin\composer).

Rails 3: Social Stream - Sphinx Install Error

I have created a new app in Rails 3.2.5, ran "bundle", then "rails
generate social_stream:install"
I got the following message:
Sphinx cannot be found on your system. You may need to configure the
following
settings in your config/sphinx.yml file:
* bin_path
* searchd_binary_name
* indexer_binary_name
==============================
My sphinx.yml looks like this:
development:
enable_star: 1
min_infix_len: 1
test:
enable_star: 1
min_infix_len: 1
production:
enable_star: 1
min_infix_len: 1
===============================
I went to: http://freelancing-god.github.com/ts/en/advanced_config.html
and looked for an appropriate config to allow me to continue moving
forward with Social_Stream, but I am stuck at this point.
Does anyone know of a config that will allow you to get pass this
error message?
What operating system are you using?
Have you actually installed the appropriate binaries?
Install Sphinx on your system. If you are using homebrew you can run the following:
brew install sphinx