how to use Stripe in laravel without using composer? - laravel

my project has been done with laravel 7 and its on a real host with cpanel as server software.
I want to online payment to website and I think Stripe is the best option but I cant figure it out how to use it without composer.
in every tutorial people used composer commands for doing this automatically, but in my case I have to put files one by one and update files.
I asked host provider about giving me composer ability on apache, but they said they cant so I have to do every thing manually.
I would be very glad if you could help me in this.

You do not need the Composer in your Hosting-Environment, If you have it in your Local-Environment then you will have the files already installed on your server. You could try Homestead what is already a pre-configured local-development environment for Laravel.
Composer is only a dependency-management-system, what makes you really easier to use open-source-code from other third party providers like the STRIPE-SDK.
But you can also use Stripes RAW REST-API's without the SDK, but it would be much more work - you can for example extract the needed parameters from the curl-example of stripe, but also if you use this direct way It would be easier to use a Curl-Wrapper-Library like Guzzle.
You should really have a deeper look into the composer, because if you want to use & contribute with some community-projects you need composer.
BTW: when you install laravel from scratch, then you still use the composer, as you see here.

While Composer is the recommended option, Stripe supports manual installation by downloading a specific version of their library and including it directly. It's also covered directly on their readme page here: https://github.com/stripe/stripe-php#manual-installation
You install the library locally by downloading the latest release and unzipping it, you add this to your own code and then you include the library like this:
require_once('/path/to/stripe-php/init.php');

Related

make laravel homestead site public without using third party services

I want to access my laravel homestead site from anywhere in the world without using third party services.I would like to know how I can do that.please help me
You might use ngrok, which is already part of Homestead, to make your site or APIs public.
I recommend deploying on laravel forge using the optimal package. It's quite affordable.
Or alternatively you might play with laravel vapor.

Using the Google Analytics PHP Client Library in Laravel

I am fairly new to Laravel and am trying to integrate the Google Analytics PHP Client Library (https://developers.google.com/analytics/devguides/reporting/core/v3/quickstart/service-php) in an application I am building.
According to the documentation , the library needs to be installed via Composer and then loaded using:
require_once __DIR__ . '/vendor/autoload.php';
In the vendors folder, I can see that there is a folder named google. So my question is, what would be the correct way to load this library in Laravel? Would it be using the code shown above, or some other method?
Thanks
The autoload.php file is already required by your laravel app, you should be able to access it by it's namespace after running composer dump-autoload as suggested by Ayaz.
You may want to look at a package like https://github.com/spatie/laravel-analytics where they've done the work to integrate the google analytics api into Laravel a bit more. Even if you don't use it I'm sure you can glean some good info from checking out the source files.
According to the documentation , the library needs to be installed via Composer and then loaded
You can do it by executing following command in your git bash or cmd
$ composer dump-autoload

Is there a class or a way that lets you run laravel code via command line?

I'm managing a website where I need to update its contents by getting rss feeds, I'm always going to my update link/route via web browser to update.
I'm planning to use crontab so that I don't need to manually update it, So is there a way to run that code via command line?
In short: Yes.
Laravel has an extensive CLI interface which allows you to do exactly that. In these commands, you have access to all Laravel resources as if it was run by the webserver.

How to avoid using php composer dump-autoload with laravel 4?

I have uploaded my project on a web host and I use ftp to edit my code.
The problem is that I added models using eloquent for my database and to get it work I have to download my project dans run php composer dump-autoload then re-upload. Otherwise its say class not found ... Doing this all the time is just heavy.
Is there any other solution?
My webhost does not have ssh or any thing to connect to the server. Neither I can use rsync like stuff.
Maybe I should use an other framework than laravel4 to avoid using composer?
In your case, you should add your needed autoload directory to the ClassLoader::addDirectories array under /app/start/global.php. Laravel gives multiple ways to accomplish the same thing depending on your personal needs.
You can remove or not upload the bootstrap/compiled.php file.
I'm not sure if this completely fixes your problem, because I'm not sure if dump-autoload generates multiple files.
[edit]An other approach is to work on your local machine and upload after you are finished.
I'm not sure, sometimes it works, sometimes not...
But I upload:
bootstrap/autoload.php
vendor/autoload.php
vendor/composer/*
And I don't have a bootstrap/compiled.php

wkhtmktopdf on shared hosting does not return any data...?

Hi friends currently i m working on a small business project.
for this project i need to convert my dynamic html page into a PDF file..
I googled for html to pdf and found wkhtml...
in my local-host system its works like charm..
But in my shared server it does not gives any output... errors also. when php wrap execute, it fails silently..
Any idea guys??
another thing.. In my shared hosting, they are disabled exec,proc_open and other process related functions, So i used .htaccess file to point another php.ini for reconfiguring the disabled_functions.
Because your hosting provider has disabled the exec methods, I'm sure they won't be pleased to find out you're trying to use wkhtmltopdf. It might be a good idea to contact them about your plans.
When downloading wkhtmltopdf, make sure you grab the right package (based on the server specs). Your best bet is to use one of the static packages as it provides most of the libraries needed to run wkhtmltopdf. You might also need to change the file permissions to be able to execute the file.
Lastly, make sure your custom php.ini is even used by php (calling phpinfo() will do the trick).

Resources